package main import ( "fmt" "log" "net/url" ) func main() { u := &url.URL{} err := u.UnmarshalBinary([]byte("https://example.org/foo")) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", u) }