go/api
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
..
except.txt all: remove scattered remnants of darwin/386 2020-04-08 18:37:38 +00:00
go1.1.txt go/constant: switch to floating-point representation when fractions become too large 2015-12-14 23:42:01 +00:00
go1.2.txt api: add go1.2.txt, use in tests 2013-10-18 13:36:59 +09:00
go1.3.txt api: add go1.3.txt 2014-06-02 11:45:00 +09:00
go1.4.txt [release-branch.go1.4] api: create go1.4.txt 2014-12-12 14:01:01 +11:00
go1.5.txt api: update go1.5.txt 2015-07-30 21:14:09 +00:00
go1.6.txt go/types: rename Importer2 to ImporterFrom 2016-01-13 23:40:13 +00:00
go1.7.txt unicode: upgrade to version 9.0.0 2016-06-28 15:08:11 +00:00
go1.8.txt Revert "cmd/go: note when some Go files were ignored on no-Go-files errors" 2016-12-21 05:25:57 +00:00
go1.9.txt doc, api: add syscall.SysProcAttr.AmbientCaps change to 1.9 notes, API 2017-06-29 03:29:46 +00:00
go1.10.txt text/template: revert CL 66410 "add break, continue actions in ranges" 2018-02-06 05:00:01 +00:00
go1.11.txt crypto/tls: make ConnectionState.ExportKeyingMaterial a method 2018-08-22 03:48:56 +00:00
go1.12.txt api: add os.(*File).SyscallConn to go1.12.txt 2019-01-02 21:21:53 +00:00
go1.13.txt api/go1.13: add debug/elf.Symbol fields added in CL 184099 2019-08-08 18:44:16 +00:00
go1.14.txt go/types: unexport Checker.LookupFieldOrMethod 2020-01-31 14:46:05 +00:00
go1.15.txt go/printer: remove exported StdFormat flag 2020-07-17 02:15:01 +00:00
go1.txt encoding/xml: add, support Marshaler interface 2013-08-14 14:58:28 -04:00
next.txt api: promote next to go1.15 2020-06-09 22:30:06 +00:00
README text/template: add variable assignments 2018-04-04 15:51:56 +00:00

Files in this directory are data for Go's API checker ("go tool api", in src/cmd/api).

Each file is a list of API features, one per line.

go1.txt (and similarly named files) are frozen once a version has been
shipped. Each file adds new lines but does not remove any.

except.txt lists features that may disappear without breaking true
compatibility.

next.txt is the only file intended to be mutated. It's a list of
features that may be added to the next version. It only affects
warning output from the go api tool.