Skip to content

Commit

Permalink
Merge pull request #14 from jacobbednarz/trim-gopath-from-stack-traces
Browse files Browse the repository at this point in the history
build: Trim GOPATH from the compiled binary
  • Loading branch information
jacobbednarz committed Oct 18, 2020
2 parents d65cdf2 + 3407f86 commit da03e11
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 da03e11

Please sign in to comment.