diff --git a/README.md b/README.md index 22db1411..dadba11c 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,7 @@ Here are the Go packages that can be imported correctly: * [math/bits](https://pkg.go.dev/math/bits) * [math/cmplx](https://pkg.go.dev/math/cmplx) * [math/rand](https://pkg.go.dev/math/rand) +* [net/url](https://pkg.go.dev/net/url) * [errors](https://pkg.go.dev/errors) * [context](https://pkg.go.dev/context) * [io](https://pkg.go.dev/io) diff --git a/_cmptest/urldemo/url.go b/_cmptest/urldemo/url.go new file mode 100644 index 00000000..bdc18888 --- /dev/null +++ b/_cmptest/urldemo/url.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "log" + "net/url" +) + +func main() { + u, err := url.Parse("http://foo.example.com/foo?bar=1") + if err != nil { + log.Fatal(err) + } + u.Scheme = "https" + u.Host = "bar.example.com" + q := u.Query() + q.Set("bar", "2") + u.RawQuery = q.Encode() + fmt.Println(u) +}