Created
May 22, 2018 21:28
-
-
Save nl5887/8dca8785bcab239a88a8ae990e65e895 to your computer and use it in GitHub Desktop.
Codesigning wrapper for Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ "$#" -eq 0 ]; then | |
| $GOROOT/bin/go $@ | |
| exit | |
| fi | |
| LDFLAGS="" | |
| if [ -e scripts/gen-ldflags.go ]; then | |
| LDFLAGS="$(go run -exec ~/.gopath/bin/sign-wrapper.sh scripts/gen-ldflags.go) $LDFLAGS" | |
| fi | |
| if [ $1 == "run" ]; then | |
| shift | |
| echo $@ | |
| $GOROOT/bin/go run -ldflags "$LDFLAGS" --exec ~/.gopath/bin/sign-wrapper.sh $@ | |
| elif [ $1 == "test" ]; then | |
| $GOROOT/bin/go test -ldflags "$LDFLAGS" --exec ~/.gopath/bin/sign-wrapper.sh ${@:2} | |
| elif [ $1 == "build" ]; then | |
| echo "Compiling binary ${@:2}" | |
| if [ $? -eq 0 ]; then | |
| FILENAME=$(echo $OUTPUT|tr ' ' '\n'|tail -n1|head -n1) | |
| echo "Signing $FILENAME..." | |
| codesign -f -s "Mac Developer: Remco Verhoef (KN95SHF89R)" $FILENAME | |
| else | |
| go build -ldflags "$LDFLAGS" ${@:2} | |
| fi | |
| else | |
| go $@ | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| codesign -f -s "Mac Developer: Remco Verhoef (KN95SHF89R)" $1 | |
| $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment