build: Add -cc argument that is not used by build.go (#5447)

This commit is contained in:
Audrius Butkevicius 2019-01-11 23:07:53 +00:00 committed by GitHub
parent 0b03b6a9ec
commit d4f0544d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,7 @@ var (
extraTags string
installSuffix string
pkgdir string
cc string
debugBinary bool
timeout = "120s"
)
@ -329,6 +330,7 @@ func parseFlags() {
flag.StringVar(&extraTags, "tags", extraTags, "Extra tags, space separated")
flag.StringVar(&installSuffix, "installsuffix", installSuffix, "Install suffix, optional")
flag.StringVar(&pkgdir, "pkgdir", "", "Set -pkgdir parameter for `go build`")
flag.StringVar(&cc, "cc", os.Getenv("CC"), "Set CC environment variable for `go build`")
flag.BoolVar(&debugBinary, "debug-binary", debugBinary, "Create unoptimized binary to use with delve, set -gcflags='-N -l' and omit -ldflags")
flag.Parse()
}
@ -398,6 +400,7 @@ func install(target target, tags []string) {
os.Setenv("GOOS", goos)
os.Setenv("GOARCH", goarch)
os.Setenv("CC", cc)
// On Windows generate a special file which the Go compiler will
// automatically use when generating Windows binaries to set things like
@ -425,6 +428,7 @@ func build(target target, tags []string) {
os.Setenv("GOOS", goos)
os.Setenv("GOARCH", goarch)
os.Setenv("CC", cc)
// On Windows generate a special file which the Go compiler will
// automatically use when generating Windows binaries to set things like