go: cmd/go: continue conversion to bug-resistant //go:build constraints
In June I posted a draft design for moving from // +build
lines with ad-hoc syntax to //go:build
lines with standard Boolean expressions; that doc also has links to a video overview and a prototype implementation.
I propose that we adopt this design, with N = 17 in the Transition section, meaning that the prep work would happen in Go 1.16, the main change would land in Go 1.17, and the transition would be finalized in Go 1.18.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 33
- Comments: 44 (10 by maintainers)
Commits related to this issue
- cmd/go: add IgnoredOtherFiles to go list; pass IgnoredFiles to vet Show constraint-ignored non-.go files in go list, as Package.IgnoredOtherFiles (same as go/build's IgnoredOtherFiles). Pass full li... — committed to golang/go by rsc 4 years ago
- cmd/compile: reject misplaced go:build comments We are converting from using error-prone ad-hoc syntax // +build lines to less error-prone, standard boolean syntax //go:build lines. The timeline is: ... — committed to golang/go by rsc 4 years ago
- cmd/asm: reject misplaced go:build comments We are converting from using error-prone ad-hoc syntax // +build lines to less error-prone, standard boolean syntax //go:build lines. The timeline is: Go ... — committed to golang/go by rsc 4 years ago
- go/build: reject //go:build without // +build We are converting from using error-prone ad-hoc syntax // +build lines to less error-prone, standard boolean syntax //go:build lines. The timeline is: G... — committed to golang/go by rsc 4 years ago
- cmd: go get golang.org/x/tools@d88ec18 && go mod vendor This brings in CL 261725, which applies the vet buildtag checker to ignored files. For #41184. Change-Id: I5f241db5a71fa84d0af0b9e9f8a75ff5bb... — committed to golang/go by rsc 4 years ago
- go/build/constraint: add parser for build tag constraint expressions This package implements a parser for the new //go:build constraint lines. The parser also handles // +build lines, to be able to p... — committed to golang/go by rsc 4 years ago
- api/go1.16: add go/build/constraint APIs These APIs were added in CL 240604 as part of an approved proposal. It was submitted after the initial api/go1.16.txt creation. For #41184 For #43407 Change... — committed to golang/go by toothrot 3 years ago
- doc/go1.16: document go/build/constraint package For #40700 For #41184 Fixes #43957 Change-Id: Ia346f4cf160431b721efeba7dc5f1fb8814efd95 Reviewed-on: https://go-review.googlesource.com/c/go/+/287472... — committed to golang/go by ianlancetaylor 3 years ago
- go/build: prefer //go:build over // +build lines Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild - Reject files with multiple //go:build lines. - If a file has both /... — committed to golang/go by rsc 4 years ago
- go/printer: canonicalize //go:build and // +build lines while formatting Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Gofmt and any other go/printer-using program ... — committed to golang/go by rsc 4 years ago
- cmd/vet: update buildtag check for //go:build lines Brings in golang.org/x/tools@2363391a and adjusts, adds cmd/vet tests accordingly. Part of //go:build change (#41184). See https://golang.org/desi... — committed to golang/go by rsc 3 years ago
- all: go fmt std cmd (but revert vendor) Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobui... — committed to golang/go by rsc 3 years ago
- unix: add //go:build lines when generating files The //+go:build lines were added by running Go 1.17 gofmt in CL 294490. Make sure to retain them when re-generating files in this package. For golang... — committed to tklauser/sys by tklauser 3 years ago
- unix: add //go:build lines when generating files The //+go:build lines were added by running Go 1.17 gofmt in CL 294490. Make sure to retain them when re-generating files in this package. For golang... — committed to tklauser/sys by tklauser 3 years ago
- unix: add //go:build lines when generating files The //+go:build lines were added by running Go 1.17 gofmt in CL 294490. Make sure to retain them when re-generating files in this package. For golang... — committed to golang/sys by tklauser 3 years ago
- all: add //go:build lines to assembly files Don't add them to files in vendor and cmd/vendor though. These will be pulled in by updating the respective dependencies. For #41184 Change-Id: Icc57458c... — committed to golang/go by tklauser 3 years ago
- cmd/vendor: update golang.org/x/sys to latest To pull in CL 318212. For #41184 Change-Id: Iec0d7bee2d3a5874c24a55ec20efd7746bf70902 Reviewed-on: https://go-review.googlesource.com/c/go/+/319410 Tru... — committed to golang/go by tklauser 3 years ago
- all: add //go:build lines to assembly files For golang/go#41184 Change-Id: Ica67fdbf2745ad2eef63dbb9ef70136e9e6fd348 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/319469 Trust: Tobias K... — committed to golang/crypto by tklauser 3 years ago
- all: update golang.org/x/net to latest To pull in CL 318309. For #41184 Change-Id: I99adb0478e71dbd72e13551a87ed09eae2a0ef2c Reviewed-on: https://go-review.googlesource.com/c/go/+/320312 Trust: Tob... — committed to golang/go by tklauser 3 years ago
- all: add //go:build lines to assembly files For golang/go#41184 Change-Id: Ica67fdbf2745ad2eef63dbb9ef70136e9e6fd348 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/319469 Trust: Tobias K... — committed to mikroskeem/golang-blake2s by tklauser 3 years ago
Based on the emoji above and the lack of any objections (along with the overwhelmingly positive Reddit thread), this seems like a likely accept.
The compiler has to be kept building with Go 1.4 for now. That means it has to keep its // +build comments. I do plan to propose bumping the bootstrap version to Go 1.17, though, for a variety of reasons, and after we’ve done that, we’d be able to remove the // +build comments.
No change in consensus, so accepted.
Change https://golang.org/cl/361480 mentions this issue:
all: remove more leftover // +build lines
All the Go 1.17 prep work for //go:build lines is now landed. I’ve remilestoned the issue to track the Go 1.18 work (submitting golang.org/cl/240611).
All the Go 1.16 prep work for //go:build lines is now landed. I’ve retitled and remilestoned the issue to track the Go 1.17 work.