Example:
package main import ( "fmt" "log" "net/url" ) func main() { u, err := url.Parse("http://bing.com/search?q=dotnet") if err != nil { log.Fatal(err) } u.Scheme = "https" u.Host = "google.com" q := u.Query() q.Set("q", "golang../") u.RawQuery = q.Encode() fmt.Println(u) } Output: https://google.com/search?q=golang..%2F here "/" is encoded to "%2F" what to do if we don't what this and want something like https://google.com/search?q=golang../ I tried to find a lot on google but didn't get anything