From 2c3074a979b1d67c5c3060441b437dbe12196044 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 21 Jun 2018 09:53:35 +0100 Subject: [PATCH 1/2] Update build script to strip by default, allow debug -d and UPX -u flags --- build | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build b/build index d7e3199..7f800c3 100755 --- a/build +++ b/build @@ -1,11 +1,25 @@ #!/bin/sh +while getopts ud option +do + case "${option}" + in + u) UPX=true;; + d) DEBUG=true;; + esac +done export GOPATH=$PWD echo "Downloading..." go get -d -v go get -d -v yggdrasil for file in *.go ; do echo "Building: $file" - go build $@ $file - #go build -ldflags="-s -w" -v $file - #upx --brute ${file/.go/} + #go build $@ $file + if [ $DEBUG ]; then + go build -tags debug -v $file + else + go build -ldflags="-s -w" -v $file + fi + if [ $UPX ]; then + upx --brute ${file/.go/} + fi done From c4d28c4f65075584fdd773eb9732c00a84dcf5fe Mon Sep 17 00:00:00 2001 From: Arceliar Date: Thu, 21 Jun 2018 09:29:05 -0500 Subject: [PATCH 2/2] Update build More portable way to strip the `.go` extension from files when packing with upx. --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 7f800c3..c07e5ea 100755 --- a/build +++ b/build @@ -20,6 +20,6 @@ for file in *.go ; do go build -ldflags="-s -w" -v $file fi if [ $UPX ]; then - upx --brute ${file/.go/} + upx --brute ${file%.go} fi done