Skip to content

Instantly share code, notes, and snippets.

@kolotaev
Created September 27, 2019 20:44
Show Gist options
  • Save kolotaev/eb2b9af645b86807785045ccb6b9d326 to your computer and use it in GitHub Desktop.
Save kolotaev/eb2b9af645b86807785045ccb6b9d326 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/url"
)
func main() {
u, _ := url.Parse("http://foo.bar?a=b")
u.User = &url.Userinfo{}
// copy
u2c := *u
u2 := &u2c
// end copy
u.Host = "hhhhh"
u2.Host = "gggg"
fmt.Printf("%#v\n", u)
fmt.Printf("%#v\n", u2c)
fmt.Printf("%#v\n", u2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment