1
0
mirror of https://github.com/golang/go synced 2024-09-30 07:18:34 -06:00
go/doc
Dmitri Shuralyov 6f264801a7 go/printer: remove exported StdFormat flag
The StdFormat flag was added as part of CL 231461, where the primary aim
was to fix the bug #37476. It's expected that the existing printer modes
only adjust spacing but do not change any of the code text itself. A new
printing flag served as a way for cmd/gofmt and go/format to delegate
a part of formatting work to the printer—where it's more more convenient
and efficient to perform—while maintaining current low-level printing
behavior of go/printer unmodified.

We already have cmd/gofmt and the go/format API that implement standard
formatting of Go source code, so there isn't a need to expose StdFormat
flag to the world, as it can only cause confusion.

Consider that to format source in canonical gofmt style completely it
may require tasks A, B, C to be done. In one version of Go, the printer
may do both A and B, while cmd/gofmt and go/format will do the remaining
task C. In another version, the printer may take on doing just A, while
cmd/gofmt and go/format will perform B and C. This makes it hard to add
a gofmt-like mode to the printer without compromising on above fluidity.

This change prefers to shift back some complexity to the implementation
of the standard library, allowing us to avoid creating the new exported
printing flag just for the internal needs of gofmt and go/format today.

We may still want to re-think the API and consider if something better
should be added, but unfortunately there isn't time for Go 1.15. We are
not adding new APIs now, so we can defer this decision until Go 1.16 or
later, when there is more time.

For #37476.
For #37453.
For #39489.
For #37419.

Change-Id: I0bb07156dca852b043487099dcf05c5350b29e20
Reviewed-on: https://go-review.googlesource.com/c/go/+/240683
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2020-07-17 02:15:01 +00:00
..
articles doc/articles/wiki: use correct variable name in closures guide 2020-03-20 08:42:30 +00:00
codewalk doc: convert remaining bash tests to Go 2019-11-14 21:33:00 +00:00
gopher doc/gopher: add model sheet 2018-07-18 04:00:10 +00:00
play doc/play: match the hello world snippet in x/website 2019-10-23 22:43:37 +00:00
progs doc: convert remaining bash tests to Go 2019-11-14 21:33:00 +00:00
asm.html doc, cmd/internal/obj/arm64: update the directives in the doc 2020-05-01 20:39:53 +00:00
cmd.html doc: remove extra br tags 2020-02-23 01:23:41 +00:00
contribute.html doc: fix typos and grammatical errors in contribute.html 2020-06-28 03:14:10 +00:00
debugging_with_gdb.html doc/debugging_with_gdb: fix the link of delve 2020-04-13 04:26:57 +00:00
diagnostics.html doc: document GODEBUG options to disable use of instruction set extensions 2018-12-18 14:59:36 +00:00
editors.html doc/editors.html: update VS Code Go extension url 2020-07-08 13:59:06 +00:00
effective_go.html doc: add note about missing lock in sample code 2020-06-30 13:02:41 +00:00
gccgo_contribute.html all: remove trailing whitespace from HTML files 2019-09-18 18:32:20 +00:00
gccgo_install.html doc/gccgo: change gold build instructions to use Git repository 2020-06-15 19:05:29 +00:00
go1.1.html doc: s/tool chain/toolchain/ 2018-01-09 21:47:03 +00:00
go1.2.html doc: use HTTPS for links 2018-06-13 13:45:01 +00:00
go1.3.html doc: rewrite reference to plan9.bell-labs.com to 9p.io 2019-08-19 21:42:54 +00:00
go1.4.html doc: use HTTPS for links 2018-06-13 13:45:01 +00:00
go1.5.html
go1.6.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.7.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.8.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.9.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.10.html all: avoid awkward wording from CL 236857 2020-06-08 21:36:04 +00:00
go1.11.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.12.html doc: align documents link 2019-08-26 17:33:52 +00:00
go1.13.html doc: rename HTML element IDs to avoid duplicates 2020-02-05 14:32:50 +00:00
go1.14.html doc/go1.14: crypto/tls.Config.NameToCertificate is deprecated 2020-06-26 17:32:19 +00:00
go1.15.html go/printer: remove exported StdFormat flag 2020-07-17 02:15:01 +00:00
go1.html doc: change anchor URLs from golang.org/dl/ to /dl/ 2018-01-20 04:13:12 +00:00
go1compat.html doc: s/tool chain/toolchain/ 2018-01-09 21:47:03 +00:00
go_faq.html doc/faq: fix a grammar mistake 2020-06-25 02:59:06 +00:00
go_mem.html doc/mem: remove unnecessary pre tags within same snippet 2020-03-03 09:28:34 +00:00
go_spec.html spec: add missing space in EBNF 2020-01-15 05:32:51 +00:00
go-logo-black.png
go-logo-blue.png
go-logo-white.png
help.html doc: add alt attribute to gopher image in help.html 2020-06-29 17:59:28 +00:00
ie.css
install-source.html doc: add riscv64 to ports list 2020-07-01 09:07:18 +00:00
install.html doc: update the minimum supported macOS version to 10.11 2020-04-01 18:26:02 +00:00
share.png
tos.html