From: Ariel Mashraki Date: Sun, 14 Mar 2021 16:12:59 +0000 (+0200) Subject: encoding/json: fix package shadowing in MarshalIndent example X-Git-Tag: go1.17beta1~1137 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a8b59fe3cdaeeb40c87d55122a45a2e390e60d88;p=gostls13.git encoding/json: fix package shadowing in MarshalIndent example Prior to this CL, pasting the example from the website causes a compilation error for some programs because it was shadowing the "json" package. Change-Id: I39b68a66ca99468547f2027a7655cf1387b61e95 Reviewed-on: https://go-review.googlesource.com/c/go/+/301492 Reviewed-by: Joe Tsai Reviewed-by: Ian Lance Taylor Trust: Joe Tsai Run-TryBot: Joe Tsai TryBot-Result: Go Bot --- diff --git a/src/encoding/json/example_test.go b/src/encoding/json/example_test.go index 2088c34297..fbecf1b593 100644 --- a/src/encoding/json/example_test.go +++ b/src/encoding/json/example_test.go @@ -279,12 +279,12 @@ func ExampleMarshalIndent() { "b": 2, } - json, err := json.MarshalIndent(data, "", "") + b, err := json.MarshalIndent(data, "", "") if err != nil { log.Fatal(err) } - fmt.Println(string(json)) + fmt.Println(string(b)) // Output: // { // "a": 1,