Closed
Description
Copying a url is often done by shallow copying the struct. This can be confusing because it's not clear if the Userinfo
should also be copied.
u, _ := url.Parse("http://foo")
// shallow copy the struct
u2 := *u
Another option is to format/re-parse the url. But this adds unnecessary overhead.
u2, _ := url.Parse(u.String())
Given how often url cloning comes up, I think it warrants adding a helper.