Created
September 27, 2019 20:44
-
-
Save kolotaev/eb2b9af645b86807785045ccb6b9d326 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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