From 8d857bab3e0126805dc51fd1babde9def5e8a2ff Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 17 May 2019 12:34:11 -0700 Subject: [PATCH] fix vendoring dependencies when building the source tarball TMPDIR is a special variable indicating the _system_ temporary directory root. Unfortunately, go refuses to honor `go.mod` files in this directory to prevent random `/tmp/go.mod` files from messing with modules cloned into `/tmp`. The fix is simple: rename TMPDIR to TEMP. --- bin/maketarball.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/maketarball.sh b/bin/maketarball.sh index 563091ecdeb..af2143d346c 100755 --- a/bin/maketarball.sh +++ b/bin/maketarball.sh @@ -13,14 +13,14 @@ fi GOCC=${GOCC=go} -TMPDIR="$(mktemp -d)" -cp -r . "$TMPDIR" -( cd "$TMPDIR" && +TEMP="$(mktemp -d)" +cp -r . "$TEMP" +( cd "$TEMP" && echo $PWD && $GOCC mod vendor && (git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || true) > .tarball && - chmod -R u=rwX,go=rX "$TMPDIR" # normalize permissions + chmod -R u=rwX,go=rX "$TEMP" # normalize permissions tar -czf "$OUTPUT" --exclude="./.git" . ) -rm -rf "$TMPDIR" +rm -rf "$TEMP"