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) stringCompare: 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))