Skip to content

Commit

Permalink
build: Trim GOPATH from the compiled binary
Browse files Browse the repository at this point in the history
Don't include my GOPATH in the compiled binary as it bum steers people
to a different issue than what is actually happening.
  • Loading branch information
jacobbednarz committed Oct 18, 2020
1 parent d65cdf2 commit 3407f86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down

0 comments on commit 3407f86

Please sign in to comment.