Skip to content
Node: path.resolve(...)github.com/sahilkhaire/gox/path

Resolve

Overview

Resolve resolves to an absolute path (path.resolve).

If you are coming from Node.js, the closest pattern is path.resolve(...).

Signature

go
func Resolve(elem ...string) string

Compare: Node.js · Standard Go · gox

js
path.resolve('/foo', 'bar');
go
abs, err := filepath.Abs(filepath.Join(base, rel))
go
import "github.com/sahilkhaire/gox/path"

p := path.Resolve("/foo", "bar")

Example

go
import "github.com/sahilkhaire/gox/path"

p := path.Resolve("/foo", "bar")

Tips

Import github.com/sahilkhaire/gox/path and call Resolve directly. See the comparison below for the standard library equivalent.

Standard library alternative

Use the standard library directly:

go
abs, err := filepath.Abs(filepath.Join(base, rel))

Back to path package overview

MIT Licensed · Built for Node.js developers moving to Go