From d49407427d1b2642184166bd36ae43070db13e36 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 11 Nov 2020 22:08:22 +0100 Subject: [PATCH] build: fix regressions with the -dlgo change (#21831) This fixes cross-build and mobile framework failures. It also disables the mac test builder because it was failing all the time in hard to understand ways and we can't afford it anymore under Travis CI's new pricing. --- .travis.yml | 18 ------------------ build/ci.go | 10 ++++++---- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 16c1e5174..03eada24a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,24 +55,6 @@ jobs: script: - go run build/ci.go test -coverage $TEST_PACKAGES - - stage: build - os: osx - osx_image: xcode11.3 - go: 1.15.x - env: - - GO111MODULE=on - script: - - echo "Increase the maximum number of open file descriptors on macOS" - - NOFILE=20480 - - sudo sysctl -w kern.maxfiles=$NOFILE - - sudo sysctl -w kern.maxfilesperproc=$NOFILE - - sudo launchctl limit maxfiles $NOFILE $NOFILE - - sudo launchctl limit maxfiles - - ulimit -S -n $NOFILE - - ulimit -n - - unset -f cd # workaround for https://github.com/travis-ci/travis-ci/issues/8703 - - go run build/ci.go test -coverage $TEST_PACKAGES - # This builder does the Ubuntu PPA upload - stage: build if: type = push diff --git a/build/ci.go b/build/ci.go index 4b6df88a4..9fa6c7142 100644 --- a/build/ci.go +++ b/build/ci.go @@ -243,7 +243,7 @@ func doInstall(cmdline []string) { } // Configure C compiler. - if *cc == "" { + if *cc != "" { gobuild.Env = append(gobuild.Env, "CC="+*cc) } else if os.Getenv("CC") != "" { gobuild.Env = append(gobuild.Env, "CC="+os.Getenv("CC")) @@ -259,6 +259,9 @@ func doInstall(cmdline []string) { // Put the default settings in. gobuild.Args = append(gobuild.Args, buildFlags(env)...) + // We use -trimpath to avoid leaking local paths into the built executables. + gobuild.Args = append(gobuild.Args, "-trimpath") + // Show packages during build. gobuild.Args = append(gobuild.Args, "-v") @@ -294,8 +297,6 @@ func buildFlags(env build.Environment) (flags []string) { if len(ld) > 0 { flags = append(flags, "-ldflags", strings.Join(ld, " ")) } - // We use -trimpath to avoid leaking local paths into the built executables. - flags = append(flags, "-trimpath") return flags } @@ -318,6 +319,7 @@ func localGoTool(goroot string, subcmd string, args ...string) *exec.Cmd { // goToolSetEnv forwards the build environment to the go tool. func goToolSetEnv(cmd *exec.Cmd) { + cmd.Env = append(cmd.Env, "GOBIN="+GOBIN) for _, e := range os.Environ() { if strings.HasPrefix(e, "GOBIN=") || strings.HasPrefix(e, "CC=") { continue @@ -514,7 +516,7 @@ func doDebianSource(cmdline []string) { gobundle := downloadGoSources(*cachedir) // Download all the dependencies needed to build the sources and run the ci script - srcdepfetch := goTool("install", "-n", "./...") + srcdepfetch := goTool("mod", "download") srcdepfetch.Env = append(os.Environ(), "GOPATH="+filepath.Join(*workdir, "modgopath")) build.MustRun(srcdepfetch)