IsAbs reports whether the URL is absolute. Absolute means that it has a non-empty scheme.
package main import ( "fmt" "net/url" ) func main() { u := url.URL{Host: "example.com", Path: "foo"} fmt.Println(u.IsAbs()) u.Scheme = "http" fmt.Println(u.IsAbs()) }