From cf9c479727d4870f06a9abe5a6f06e6b874d79d0 Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 9 Oct 2014 20:57:56 +0100 Subject: [PATCH] check that the go stdlib was built with the required options AFAICT, go build tags are a compile-time only construct, so there is no way to query whether a certain package was built with a specific tag. However, the 'netgo' tag triggers conditional compilation of the cgo_stubs.go file, and that file name ends up in the executable. (we could have looked for specific symbols in the 'net.a' library instead, but that requires locating it first, which is more hassle than it is worth) issue #93 --- weaver/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/weaver/Makefile b/weaver/Makefile index 38898deb..e5b53486 100644 --- a/weaver/Makefile +++ b/weaver/Makefile @@ -8,6 +8,13 @@ all: docker-image weaver: ../*.go main.go go get -tags netgo go build -ldflags '-extldflags "-static"' -tags netgo + @strings $@ | grep cgo_stub\\\.go >/dev/null || { \ + rm $@; \ + echo "\nYour go standard library was built without the 'netgo' build tag."; \ + echo "To fix that, run"; \ + echo " sudo go install -a -tags netgo std"; \ + false; \ + } .PHONY: docker-image docker-image: /var/tmp/weave.tar