Skip to content

Commit c4e29bb

Browse files
dmitshurbradfitz
authored andcommitted
encoding/json: de-indent raw strings in remaining examples
This change fixes the remaining examples where the raw strings had suboptimal indentation (one level too many) when viewed in godoc. Follows CL 48910. Fixes #21026. Change-Id: Ifc0dae3fa899a9fff8b1ff958414e2fe6852321d Reviewed-on: https://go-review.googlesource.com/50990 Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 6dae588 commit c4e29bb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/encoding/json/example_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ func ExampleMarshal() {
3636

3737
func ExampleUnmarshal() {
3838
var jsonBlob = []byte(`[
39-
{"Name": "Platypus", "Order": "Monotremata"},
40-
{"Name": "Quoll", "Order": "Dasyuromorphia"}
41-
]`)
39+
{"Name": "Platypus", "Order": "Monotremata"},
40+
{"Name": "Quoll", "Order": "Dasyuromorphia"}
41+
]`)
4242
type Animal struct {
4343
Name string
4444
Order string
@@ -56,12 +56,12 @@ func ExampleUnmarshal() {
5656
// This example uses a Decoder to decode a stream of distinct JSON values.
5757
func ExampleDecoder() {
5858
const jsonStream = `
59-
{"Name": "Ed", "Text": "Knock knock."}
60-
{"Name": "Sam", "Text": "Who's there?"}
61-
{"Name": "Ed", "Text": "Go fmt."}
62-
{"Name": "Sam", "Text": "Go fmt who?"}
63-
{"Name": "Ed", "Text": "Go fmt yourself!"}
64-
`
59+
{"Name": "Ed", "Text": "Knock knock."}
60+
{"Name": "Sam", "Text": "Who's there?"}
61+
{"Name": "Ed", "Text": "Go fmt."}
62+
{"Name": "Sam", "Text": "Go fmt who?"}
63+
{"Name": "Ed", "Text": "Go fmt yourself!"}
64+
`
6565
type Message struct {
6666
Name, Text string
6767
}
@@ -86,8 +86,8 @@ func ExampleDecoder() {
8686
// This example uses a Decoder to decode a stream of distinct JSON values.
8787
func ExampleDecoder_Token() {
8888
const jsonStream = `
89-
{"Message": "Hello", "Array": [1, 2, 3], "Null": null, "Number": 1.234}
90-
`
89+
{"Message": "Hello", "Array": [1, 2, 3], "Null": null, "Number": 1.234}
90+
`
9191
dec := json.NewDecoder(strings.NewReader(jsonStream))
9292
for {
9393
t, err := dec.Token()
@@ -191,9 +191,9 @@ func ExampleRawMessage_unmarshal() {
191191
}
192192

193193
var j = []byte(`[
194-
{"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}},
195-
{"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}}
196-
]`)
194+
{"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}},
195+
{"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}}
196+
]`)
197197
var colors []Color
198198
err := json.Unmarshal(j, &colors)
199199
if err != nil {

0 commit comments

Comments
 (0)