go/src/cmd
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
..
addr2line run.bat: do not unset GOROOT_FINAL before running tests 2020-06-10 03:27:28 +00:00
api cmd/api: limit concurrent 'go list' calls to GOMAXPROCS 2020-04-20 21:23:00 +00:00
asm cmd/asm: fix the encoding error of VCNT instruction for arm64 2020-06-09 15:58:36 +00:00
buildid
cgo cmd/cgo: prevent redeclaration of _Ctype_void when C.void is used 2020-06-26 19:00:25 +00:00
compile cmd/compile: remove check that Zero's arg has the correct base type 2020-06-25 15:59:48 +00:00
cover cmd/cover: include a package name in the HTML title 2020-04-30 03:58:01 +00:00
dist crypto/x509: restore support for ios tag on darwin/amd64 2020-06-24 20:16:49 +00:00
doc cmd/doc: don't print package clauses on error 2020-04-17 21:42:13 +00:00
fix cmd/cgo,cmd/fix,misc/cgo: map the EGLConfig C type to uintptr in Go 2020-05-31 09:48:08 +00:00
go cmd/go: include GOMODCACHE in 'go help environment' 2020-07-13 17:48:55 +00:00
gofmt go/printer: remove exported StdFormat flag 2020-07-17 02:15:01 +00:00
internal cmd/internal/obj/ppc64: update doc 2020-06-18 12:34:50 +00:00
link cmd/link: skip TestOldLink if the old linker does not exist 2020-07-15 00:59:51 +00:00
nm Revert "cmd/internal/goobj: add index to symbol name for indexed symbols" 2020-06-03 19:20:41 +00:00
objdump cmd/dist: do not unset GOROOT_FINAL prior to running tests 2020-06-09 02:49:06 +00:00
oldlink cmd/oldlink: port bug fixes to old linker 2020-07-06 20:17:51 +00:00
pack
pprof cmd/objdump: add support for -gnu option on Go objdump 2020-03-30 14:30:49 +00:00
test2json
trace cmd/trace: fix the broken link in region pages and improve UX 2020-04-21 14:57:43 +00:00
vendor all: go get golang.org/x/net@ab3426394381 2020-07-07 16:14:42 +00:00
vet
README.vendor
go.mod all: go get golang.org/x/net@ab3426394381 2020-07-07 16:14:42 +00:00
go.sum all: go get golang.org/x/net@ab3426394381 2020-07-07 16:14:42 +00:00

README.vendor

See src/README.vendor for information on loading vendored packages
and updating the vendor directory.