diff options
| author | José Joaquín Atria <jjatria@gmail.com> | 2025-11-24 19:52:22 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-25 10:41:33 -0800 |
| commit | 657b331ff5da9b02bd98b489ff144a03c6651bae (patch) | |
| tree | 770a6b6caca5f5a6e405c68278af3b3ff6afbda8 /src/net | |
| parent | bd9222b525b44d91941fc4d179b467103817d463 (diff) | |
| download | go-657b331ff5da9b02bd98b489ff144a03c6651bae.tar.xz | |
net/url: fix example of Values.Encode
Calling url.Values.Encode generates a query string with the
values sorted by key. However, in the example in the documentation
this behaviour is not reflected. This change corrects this.
Change-Id: Id95a5d79b57dc20c3bff1f0c6975c76dcd8412b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/723960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/url/example_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net/url/example_test.go b/src/net/url/example_test.go index 311ba5c329..bae83ab1d0 100644 --- a/src/net/url/example_test.go +++ b/src/net/url/example_test.go @@ -58,11 +58,12 @@ func ExampleValues() { v.Add("friend", "Jess") v.Add("friend", "Sarah") v.Add("friend", "Zoe") - // v.Encode() == "name=Ava&friend=Jess&friend=Sarah&friend=Zoe" + fmt.Println(v.Encode()) fmt.Println(v.Get("name")) fmt.Println(v.Get("friend")) fmt.Println(v["friend"]) // Output: + // friend=Jess&friend=Sarah&friend=Zoe&name=Ava // Ava // Jess // [Jess Sarah Zoe] |
