diff options
author | Sebastian Lackner | 2018-12-26 21:45:10 +0100 |
---|---|---|
committer | rfjakob | 2018-12-27 15:08:35 +0100 |
commit | 2a010263f62c8ad82952a7c2c661baa9706c6155 (patch) | |
tree | 0063676a185fa1ff766a9ff5d9c378e5a7eecdeb | |
parent | 3cba378ad5a996a28a012147539cc8721a1133cc (diff) |
build.bash: Escape LDFLAGS before passing them to 'go build'.
This ensures that ./build.bash still works when the LDFLAGS environment
variable contains multiple options, e.g., LDFLAGS="-lpthread -lm". The
correct way of passing multiple options is discussed here:
https://github.com/golang/go/issues/6234
For some unknown reason, the method only works when -extldflags is the
last argument - is this a bug in Go?
-rwxr-xr-x | build.bash | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -84,7 +84,7 @@ GO_LDFLAGS="-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUS # If LDFLAGS is set, add it as "-extldflags". if [[ -n ${LDFLAGS:-} ]] ; then - GO_LDFLAGS="-extldflags=$LDFLAGS $GO_LDFLAGS" + GO_LDFLAGS="$GO_LDFLAGS \"-extldflags=$LDFLAGS\"" fi # Actual "go build" call |