From 3407f862cacf8b7725e19f72a3e57b1f7f429172 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Mon, 19 Oct 2020 08:55:01 +1100 Subject: [PATCH] build: Trim GOPATH from the compiled binary Don't include my GOPATH in the compiled binary as it bum steers people to a different issue than what is actually happening. --- script/build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script/build b/script/build index dc802e4..f4eb21e 100755 --- a/script/build +++ b/script/build @@ -31,11 +31,13 @@ do printf "==> Building %s\t%s\n" "$platform" "build/$output_name" | expand -t 30 + # trim GOPATH from the stacktraces + GCFLAGS="-gcflags=all=-trimpath=$GOPATH -asmflags=all=-trimpath=$GOPATH" if [ $GOOS = "windows" ]; then - env GOOS=$GOOS GOARCH=$GOARCH go build -o "build/${GOOS}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" . + env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" . else - env GOOS=$GOOS GOARCH=$GOARCH go build -o "build/${GOOS}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" . + env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" . fi if [ $? -ne 0 ]; then echo "Building the binary has failed!"