From: José Joaquín Atria Date: Mon, 24 Nov 2025 19:52:22 +0000 (+0000) Subject: net/url: fix example of Values.Encode X-Git-Tag: go1.26rc1~122 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=657b331ff5;p=gostls13.git 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 Reviewed-by: Damien Neil Auto-Submit: Damien Neil Reviewed-by: Sean Liao Reviewed-by: Florian Lehner Reviewed-by: Cherry Mui Auto-Submit: Sean Liao --- 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]