Commit c4e29bbd authored by Dmitri Shuralyov's avatar Dmitri Shuralyov Committed by Brad Fitzpatrick

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 <shurcool@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 6dae588a
...@@ -36,9 +36,9 @@ func ExampleMarshal() { ...@@ -36,9 +36,9 @@ func ExampleMarshal() {
func ExampleUnmarshal() { func ExampleUnmarshal() {
var jsonBlob = []byte(`[ var jsonBlob = []byte(`[
{"Name": "Platypus", "Order": "Monotremata"}, {"Name": "Platypus", "Order": "Monotremata"},
{"Name": "Quoll", "Order": "Dasyuromorphia"} {"Name": "Quoll", "Order": "Dasyuromorphia"}
]`) ]`)
type Animal struct { type Animal struct {
Name string Name string
Order string Order string
...@@ -56,12 +56,12 @@ func ExampleUnmarshal() { ...@@ -56,12 +56,12 @@ func ExampleUnmarshal() {
// This example uses a Decoder to decode a stream of distinct JSON values. // This example uses a Decoder to decode a stream of distinct JSON values.
func ExampleDecoder() { func ExampleDecoder() {
const jsonStream = ` const jsonStream = `
{"Name": "Ed", "Text": "Knock knock."} {"Name": "Ed", "Text": "Knock knock."}
{"Name": "Sam", "Text": "Who's there?"} {"Name": "Sam", "Text": "Who's there?"}
{"Name": "Ed", "Text": "Go fmt."} {"Name": "Ed", "Text": "Go fmt."}
{"Name": "Sam", "Text": "Go fmt who?"} {"Name": "Sam", "Text": "Go fmt who?"}
{"Name": "Ed", "Text": "Go fmt yourself!"} {"Name": "Ed", "Text": "Go fmt yourself!"}
` `
type Message struct { type Message struct {
Name, Text string Name, Text string
} }
...@@ -86,8 +86,8 @@ func ExampleDecoder() { ...@@ -86,8 +86,8 @@ func ExampleDecoder() {
// This example uses a Decoder to decode a stream of distinct JSON values. // This example uses a Decoder to decode a stream of distinct JSON values.
func ExampleDecoder_Token() { func ExampleDecoder_Token() {
const jsonStream = ` const jsonStream = `
{"Message": "Hello", "Array": [1, 2, 3], "Null": null, "Number": 1.234} {"Message": "Hello", "Array": [1, 2, 3], "Null": null, "Number": 1.234}
` `
dec := json.NewDecoder(strings.NewReader(jsonStream)) dec := json.NewDecoder(strings.NewReader(jsonStream))
for { for {
t, err := dec.Token() t, err := dec.Token()
...@@ -191,9 +191,9 @@ func ExampleRawMessage_unmarshal() { ...@@ -191,9 +191,9 @@ func ExampleRawMessage_unmarshal() {
} }
var j = []byte(`[ var j = []byte(`[
{"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}}, {"Space": "YCbCr", "Point": {"Y": 255, "Cb": 0, "Cr": -10}},
{"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}} {"Space": "RGB", "Point": {"R": 98, "G": 218, "B": 255}}
]`) ]`)
var colors []Color var colors []Color
err := json.Unmarshal(j, &colors) err := json.Unmarshal(j, &colors)
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment