encoding/json: indentation of raw strings in examples looks suboptimal in godoc #21026
There are two ways a Go example can be read:
In most cases, examples look equally good in both interfaces. However, in some cases, there may be two alternative ways to write an example, such that one of them looks better inside source code, and the other looks better in the godoc interface.
My understanding is that it's better to prioritize the godoc interface over the source code, since most people will be reading examples via godoc (be it locally, or via https://godoc.org, or https://golang.org/pkg/). If that is not correct, the rest of this issue is not valid.
I found that there are 5 examples in
Their readability in godoc interface can be improved by dedenting the contents of the raw string by 1 tab.
The text was updated successfully, but these errors were encountered:
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 <firstname.lastname@example.org> Reviewed-by: Brad Fitzpatrick <email@example.com>