String reassembles the URL into a valid URL string. The general form of the result is one of:
package main import ( "fmt" "net/url" ) func main() { u := &url.URL{ Scheme: "https", User: url.UserPassword("me", "pass"), Host: "example.com", Path: "foo/bar", RawQuery: "x=1&y=2", Fragment: "anchor", } fmt.Println(u.String()) u.Opaque = "opaque" fmt.Println(u.String()) }