diff options
author | Dmitri Shuralyov <dmitshur@golang.org> | 2020-07-01 12:49:43 -0400 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2020-07-17 02:15:01 +0000 |
commit | 6f264801a76bbf1a0defacba4230efaefc47598c (patch) | |
tree | 62e26fcd8386a98a5974847c92017cfd8a1f6f06 /api | |
parent | 4469f5446ad754d87afb340f59c213aec2dc4fb8 (diff) | |
download | go-6f264801a76bbf1a0defacba4230efaefc47598c.tar.gz go-6f264801a76bbf1a0defacba4230efaefc47598c.zip |
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>
Diffstat (limited to 'api')
-rw-r--r-- | api/go1.15.txt | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/api/go1.15.txt b/api/go1.15.txt index b51837cf38..dd90506eba 100644 --- a/api/go1.15.txt +++ b/api/go1.15.txt @@ -112,8 +112,6 @@ pkg debug/pe, const IMAGE_SUBSYSTEM_WINDOWS_GUI = 2 pkg debug/pe, const IMAGE_SUBSYSTEM_WINDOWS_GUI ideal-int pkg debug/pe, const IMAGE_SUBSYSTEM_XBOX = 14 pkg debug/pe, const IMAGE_SUBSYSTEM_XBOX ideal-int -pkg go/printer, const StdFormat = 16 -pkg go/printer, const StdFormat Mode pkg math/big, method (*Int) FillBytes([]uint8) []uint8 pkg net, method (*Resolver) LookupIP(context.Context, string, string) ([]IP, error) pkg net/url, method (*URL) EscapedFragment() string |