Resolve
Overview
Resolve resolves relative against base (url.resolve).
If you are coming from Node.js, the closest pattern is url.resolve(base, rel).
Signature
go
func Resolve(base, relative string) (string, error)Compare: Node.js · Standard Go · gox
js
url.resolve(base, rel)go
u := &url.URL{Scheme: "https", Host: host, Path: path}go
import "github.com/sahilkhaire/gox/url"
url.Resolve(base, rel)Example
go
import "github.com/sahilkhaire/gox/url"
url.Resolve(base, rel)Tips
Import github.com/sahilkhaire/gox/url and call Resolve directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
u := &url.URL{Scheme: "https", Host: host, Path: path}