A URL represents a parsed URL (technically, a URI reference).
package main import ( "fmt" "log" "net/url" ) func main() { // Parse + String preserve the original encoding. u, err := url.Parse("https://example.com/foo%2fbar") if err != nil { log.Fatal(err) } fmt.Println(u.Path) fmt.Println(u.RawPath) fmt.Println(u.String()) }