Skip to content

Commit

Permalink
Makefile: replace GOFLAGS with BLDFLAGS
Browse files Browse the repository at this point in the history
new in go-1.11 GOFLAGS is an environment variable used by go build
with conflicting escaping compared to how we used it in the Makefile
  • Loading branch information
ploxiln committed Sep 24, 2018
1 parent 8f6fa1f commit d1ee283
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN wget -O /bin/dep https://github.com/golang/dep/releases/download/v0.4.1/dep-
&& chmod +x /bin/dep \
&& /bin/dep ensure \
&& ./test.sh \
&& CGO_ENABLED=0 make DESTDIR=/opt PREFIX=/nsq GOFLAGS='-ldflags="-s -w"' install
&& CGO_ENABLED=0 make DESTDIR=/opt PREFIX=/nsq BLDFLAGS='-ldflags="-s -w"' install

FROM alpine:3.7

Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
PREFIX=/usr/local
DESTDIR=
GOFLAGS=
BINDIR=${PREFIX}/bin

DESTDIR=
BLDDIR = build
BLDFLAGS=
EXT=
ifeq (${GOOS},windows)
EXT=.exe
Expand All @@ -24,7 +23,7 @@ $(BLDDIR)/to_nsq: $(wildcard apps/to_nsq/*.go internal/*/*.go

$(BLDDIR)/%:
@mkdir -p $(dir $@)
go build ${GOFLAGS} -o $@ ./apps/$*
go build ${BLDFLAGS} -o $@ ./apps/$*

$(APPS): %: $(BLDDIR)/%

Expand Down
2 changes: 1 addition & 1 deletion dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for os in linux darwin freebsd windows; do
BUILD=$(mktemp -d ${TMPDIR:-/tmp}/nsq-XXXXX)
TARGET="nsq-$version.$os-$arch.$goversion"
GOOS=$os GOARCH=$arch CGO_ENABLED=0 \
make DESTDIR=$BUILD PREFIX=/$TARGET GOFLAGS="$GOFLAGS" install
make DESTDIR=$BUILD PREFIX=/$TARGET BLDFLAGS="$GOFLAGS" install
pushd $BUILD
sudo chown -R 0:0 $TARGET
tar czvf $TARGET.tar.gz $TARGET
Expand Down

0 comments on commit d1ee283

Please sign in to comment.