mirror of
https://github.com/golang/go.git
synced 2026-02-06 18:00:01 +00:00
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>
This commit is contained in:
parent
bd9222b525
commit
657b331ff5
1 changed files with 2 additions and 1 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue