<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go/src/encoding/json/example_test.go, branch fix-runtime-test-GOMAXPROCS</title>
<subtitle>Fork of Go programming language with my patches.</subtitle>
<id>http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS</id>
<link rel='self' href='http://git.kilabit.info/go/atom?h=fix-runtime-test-GOMAXPROCS'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/'/>
<updated>2025-04-18T15:24:07Z</updated>
<entry>
<title>encoding/json: add json/v2 with GOEXPERIMENT=jsonv2 guard</title>
<updated>2025-04-18T15:24:07Z</updated>
<author>
<name>Damien Neil</name>
<email>dneil@google.com</email>
</author>
<published>2025-04-11T21:19:51Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=0e17905793cb5e0acc323a0cdf3733199d93976a'/>
<id>urn:sha1:0e17905793cb5e0acc323a0cdf3733199d93976a</id>
<content type='text'>
This imports the proposed new v2 JSON API implemented in
github.com/go-json-experiment/json as of commit
d3c622f1b874954c355e60c8e6b6baa5f60d2fed.

When GOEXPERIMENT=jsonv2 is set, the encoding/json/v2 and
encoding/jsontext packages are visible, the encoding/json
package is implemented in terms of encoding/json/v2, and
the encoding/json package include various additional APIs.
(See #71497 for details.)

When GOEXPERIMENT=jsonv2 is not set, the new API is not
present and the encoding/json package is unchanged.

The experimental API is not bound by the Go compatibility
promise and is expected to evolve as updates are made to
the json/v2 proposal.

The contents of encoding/json/internal/jsontest/testdata
are compressed with zstd v1.5.7 with the -19 option.

Fixes #71845
For #71497

Change-Id: Ib8c94e5f0586b6aaa22833190b41cf6ef59f4f01
Reviewed-on: https://go-review.googlesource.com/c/go/+/665796
Auto-Submit: Damien Neil &lt;dneil@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Michael Pratt &lt;mpratt@google.com&gt;
Reviewed-by: Joseph Tsai &lt;joetsai@digital-static.net&gt;
Reviewed-by: Dmitri Shuralyov &lt;dmitshur@google.com&gt;
</content>
</entry>
<entry>
<title>all: gofmt -w -r 'interface{} -&gt; any' src</title>
<updated>2021-12-13T18:45:54Z</updated>
<author>
<name>Russ Cox</name>
<email>rsc@golang.org</email>
</author>
<published>2021-12-01T17:15:45Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=2580d0e08d5e9f979b943758d3c49877fb2324cb'/>
<id>urn:sha1:2580d0e08d5e9f979b943758d3c49877fb2324cb</id>
<content type='text'>
And then revert the bootstrap cmd directories and certain testdata.
And adjust tests as needed.

Not reverting the changes in std that are bootstrapped,
because some of those changes would appear in API docs,
and we want to use any consistently.
Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories
when preparing the bootstrap copy.

A few files changed as a result of running gofmt -w
not because of interface{} -&gt; any but because they
hadn't been updated for the new //go:build lines.

Fixes #49884.

Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09
Reviewed-on: https://go-review.googlesource.com/c/go/+/368254
Trust: Russ Cox &lt;rsc@golang.org&gt;
Run-TryBot: Russ Cox &lt;rsc@golang.org&gt;
Reviewed-by: Robert Griesemer &lt;gri@golang.org&gt;
TryBot-Result: Gopher Robot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: fix package shadowing in MarshalIndent example</title>
<updated>2021-03-14T19:58:14Z</updated>
<author>
<name>Ariel Mashraki</name>
<email>ariel@mashraki.co.il</email>
</author>
<published>2021-03-14T16:12:59Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=a8b59fe3cdaeeb40c87d55122a45a2e390e60d88'/>
<id>urn:sha1:a8b59fe3cdaeeb40c87d55122a45a2e390e60d88</id>
<content type='text'>
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 &lt;joetsai@google.com&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
Trust: Joe Tsai &lt;joetsai@google.com&gt;
Run-TryBot: Joe Tsai &lt;joetsai@google.com&gt;
TryBot-Result: Go Bot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: use SetBytes in UnmarshalReuse benchmark</title>
<updated>2019-04-05T20:54:50Z</updated>
<author>
<name>Daniel Martí</name>
<email>mvdan@mvdan.cc</email>
</author>
<published>2019-04-05T20:28:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=cb6646234cb6565d19d9efea987c8d8fc9be5c31'/>
<id>urn:sha1:cb6646234cb6565d19d9efea987c8d8fc9be5c31</id>
<content type='text'>
This was the only benchmark missing the SetBytes call, as spotted
earlier by Bryan.

It's not required to make the benchmark useful, but it can still be a
good way to see how its speed is affected by the reduced allocations:

name                  time/op
CodeUnmarshal-8        12.1ms ± 1%
CodeUnmarshalReuse-8   11.4ms ± 1%

name                  speed
CodeUnmarshal-8       161MB/s ± 1%
CodeUnmarshalReuse-8  171MB/s ± 1%

name                  alloc/op
CodeUnmarshal-8        3.28MB ± 0%
CodeUnmarshalReuse-8   1.94MB ± 0%

name                  allocs/op
CodeUnmarshal-8         92.7k ± 0%
CodeUnmarshalReuse-8    77.6k ± 0%

While at it, remove some unnecessary empty lines.

Change-Id: Ib2bd92d5b3237b8f3092e8c6f863dab548fee2f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/170938
Run-TryBot: Daniel Martí &lt;mvdan@mvdan.cc&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: add example for json.HTMLEscape</title>
<updated>2019-02-26T18:14:45Z</updated>
<author>
<name>Ketan Parmar</name>
<email>ketanbparmar@gmail.com</email>
</author>
<published>2019-01-31T01:58:15Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=8cf1d1634a423a9509c54a6cc8e2ec632a8a6e38'/>
<id>urn:sha1:8cf1d1634a423a9509c54a6cc8e2ec632a8a6e38</id>
<content type='text'>
Change-Id: Ib00fcfd46eae27eea0a3d4cab4406f4c461fb57b
Reviewed-on: https://go-review.googlesource.com/c/160517
Reviewed-by: Andrew Bonventre &lt;andybons@golang.org&gt;
Run-TryBot: Andrew Bonventre &lt;andybons@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: add example to Valid</title>
<updated>2018-10-28T19:49:25Z</updated>
<author>
<name>hearot</name>
<email>gabriel@hearot.it</email>
</author>
<published>2018-10-27T18:43:21Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=3fe9d4c1c89f2a10e78780c421a2f5d93f218061'/>
<id>urn:sha1:3fe9d4c1c89f2a10e78780c421a2f5d93f218061</id>
<content type='text'>
Change-Id: I411483d76a2ca91cd15ff42ae1adb9134486d183
Reviewed-on: https://go-review.googlesource.com/c/145278
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: update documentation for MarshalIndent</title>
<updated>2017-09-12T18:12:24Z</updated>
<author>
<name>tbunyk</name>
<email>tbunyk@gmail.com</email>
</author>
<published>2017-09-05T16:01:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=b86fae041baff7a7077c67060bc4282d78a2118b'/>
<id>urn:sha1:b86fae041baff7a7077c67060bc4282d78a2118b</id>
<content type='text'>
Make arguments semantics clear without the need to look for
json.Indent documentation.

Change-Id: If9adfe9f477a30d426ae83790b0f2578c0a809b7
Reviewed-on: https://go-review.googlesource.com/61670
Run-TryBot: Ian Lance Taylor &lt;iant@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Ian Lance Taylor &lt;iant@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: de-indent raw strings in remaining examples</title>
<updated>2017-08-08T04:30:58Z</updated>
<author>
<name>Dmitri Shuralyov</name>
<email>shurcooL@gmail.com</email>
</author>
<published>2017-07-16T05:58:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=c4e29bbd3813be43b3905e17a2796cea23dd66d4'/>
<id>urn:sha1:c4e29bbd3813be43b3905e17a2796cea23dd66d4</id>
<content type='text'>
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 &lt;shurcool@gmail.com&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: fix indentation in Decode stream example</title>
<updated>2017-07-15T21:35:22Z</updated>
<author>
<name>Iccha Sethi</name>
<email>icchasethi@gmail.com</email>
</author>
<published>2017-07-15T18:28:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=ba6cd156f30ad9d5b42663cdd93e58f0b91b9811'/>
<id>urn:sha1:ba6cd156f30ad9d5b42663cdd93e58f0b91b9811</id>
<content type='text'>
The existing example for Decoder.Decode (Stream) had excessive
indentation in the godoc interface for the const jsonStream,
making it hard to read. This fixes the indentation in the
example_test.go to improve the readability in godoc.

Helps #21026.

Change-Id: I16f56b82182da1dcc73cca44e535a7f5695e975d
Reviewed-on: https://go-review.googlesource.com/48910
Reviewed-by: Dmitri Shuralyov &lt;shurcool@gmail.com&gt;
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
</content>
</entry>
<entry>
<title>encoding/json: add example for RawMessage marshalling</title>
<updated>2016-08-16T00:22:47Z</updated>
<author>
<name>Carlos C</name>
<email>uldericofilho@gmail.com</email>
</author>
<published>2016-08-10T14:24:11Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go/commit/?id=7a974a4c602252ca7db5b35c1236b45ead4c1d54'/>
<id>urn:sha1:7a974a4c602252ca7db5b35c1236b45ead4c1d54</id>
<content type='text'>
Fixes #16648

Change-Id: I3ab21ab33ca3f41219de9518ac6a39f49131e5e5
Reviewed-on: https://go-review.googlesource.com/26692
Reviewed-by: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
Run-TryBot: Brad Fitzpatrick &lt;bradfitz@golang.org&gt;
TryBot-Result: Gobot Gobot &lt;gobot@golang.org&gt;
</content>
</entry>
</feed>
