• Russ Cox's avatar
    cmd/dist, cmd/go: treat cmd/cgo like other build tools · 555c16d8
    Russ Cox authored
    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: 's avatarDavid Crawshaw <crawshaw@golang.org>
    555c16d8
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...