aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorAriel Mashraki <ariel@mashraki.co.il>2021-03-14 18:12:59 +0200
committerIan Lance Taylor <iant@golang.org>2021-03-14 19:58:14 +0000
commita8b59fe3cdaeeb40c87d55122a45a2e390e60d88 (patch)
treea61309b80c3d958e72efafae7e3117baaf221c0e /src/encoding
parent061a6903a232cb868780b1e724a75bf92a728489 (diff)
downloadgo-a8b59fe3cdaeeb40c87d55122a45a2e390e60d88.tar.gz
go-a8b59fe3cdaeeb40c87d55122a45a2e390e60d88.zip
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 <joetsai@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Joe Tsai <joetsai@google.com> Run-TryBot: Joe Tsai <joetsai@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/encoding')
-rw-r--r--src/encoding/json/example_test.go4
1 files changed, 2 insertions, 2 deletions
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, "<prefix>", "<indent>")
+ b, err := json.MarshalIndent(data, "<prefix>", "<indent>")
if err != nil {
log.Fatal(err)
}
- fmt.Println(string(json))
+ fmt.Println(string(b))
// Output:
// {
// <prefix><indent>"a": 1,