commit | 555c16d8cbd8372c1f57beb059a23b56bf1e909f | [log] [tgz] |
---|---|---|
author | Russ Cox <rsc@golang.org> | Thu Oct 05 10:07:19 2017 -0400 |
committer | Russ Cox <rsc@golang.org> | Thu Oct 05 18:50:32 2017 +0000 |
tree | b8cccfe5990c915915f717d8070477e9e47d4c25 | |
parent | 9e21e9c5cb27e5f2b5acba14efb6bb6f126595cc [diff] |
cmd/dist, cmd/go: treat cmd/cgo like other build tools The primary build tools cmd/asm, cmd/compile, and cmd/link are built during cmd/dist bootstrap and then assumed by cmd/go to be available for any future builds. The only tool invoked by cmd/go during a build and not in this list is cmd/cgo; instead of being built during cmd/dist and assumed by cmd/go, cmd/go arranges to build cmd/cgo if needed as part of the regular build. We got here because at the time cmd/go was written, cmd/cgo was the only build tool written in Go (the others were in C), and so it made some sense to put cmd/dist in charge of building the C tools and to have custom code in cmd/go to build cmd/cgo just in time for it to be used by a particular build. This custom code has historically been quite subtle, though, because the build of cmd/cgo inherits whatever build flags apply to the build that wants to use cmd/cgo. If you're not careful, "go install -race strings" might under the wrong circumstances also install a race-enabled cmd/cgo binary, which is unexpected at the least. The custom code is only going to get more problematic as we move toward more precise analysis of whether dependencies are up-to-date. In that case, "go build -race strings" will check to see if there is not just a cmd/cgo already but a race-enabled cmd/cgo, which makes no sense. Instead of perpetuating the special case, treat cgo like all the other build tools: build it first in cmd/dist, and then assume it is present. This simplifies cmd/go. Building cmd/cgo during bootstrap also allows the default build of cmd/cgo to be built using cgo, which may be necessary on future essentially-cgo-only systems. Change-Id: I414e22c10c9920f4e98f97fa35ff22058c0f143d Reviewed-on: https://go-review.googlesource.com/68338 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project does not use GitHub pull requests, and that we use the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.