Jelajahi Sumber

Merge pull request #10087 from tianon/proper-netgo-thanks-rsc

Add proper "netgo" compiling, thanks to rsc ♥
Jessie Frazelle 10 tahun lalu
induk
melakukan
c05e7c4135
2 mengubah file dengan 2 tambahan dan 4 penghapusan
  1. 0 3
      Dockerfile
  2. 2 1
      project/make.sh

+ 0 - 3
Dockerfile

@@ -97,9 +97,6 @@ RUN cd /usr/local/go/src \
 			./make.bash --no-clean 2>&1; \
 			./make.bash --no-clean 2>&1; \
 	done
 	done
 
 
-# Reinstall standard library with netgo
-RUN go clean -i net && go install -tags netgo std
-
 # We still support compiling with older Go, so need to grab older "gofmt"
 # We still support compiling with older Go, so need to grab older "gofmt"
 ENV GOFMT_VERSION 1.3.3
 ENV GOFMT_VERSION 1.3.3
 RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt
 RUN curl -sSL https://storage.googleapis.com/golang/go${GOFMT_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz | tar -C /go/bin -xz --strip-components=2 go/bin/gofmt

+ 2 - 1
project/make.sh

@@ -113,7 +113,8 @@ fi
 EXTLDFLAGS_STATIC='-static'
 EXTLDFLAGS_STATIC='-static'
 # ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
 # ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
 # with options like -race.
 # with options like -race.
-ORIG_BUILDFLAGS=( -a -tags "netgo static_build $DOCKER_BUILDTAGS" )
+ORIG_BUILDFLAGS=( -a -tags "netgo static_build $DOCKER_BUILDTAGS" -installsuffix netgo )
+# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
 BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
 BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
 # Test timeout.
 # Test timeout.
 : ${TIMEOUT:=30m}
 : ${TIMEOUT:=30m}