mirror of
https://github.com/pcvolkmer/docker-pps.git
synced 2025-04-19 09:46:50 +00:00
Binary will be build in corresponding GOOS-GOARCH folder. Install command will build and install binary for current platform until GOOS and/or GOARCH env var is set.
33 lines
432 B
Bash
33 lines
432 B
Bash
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
TARGET=${TARGET:-"target"}
|
|
|
|
GOOS="$(go env GOOS)"
|
|
GOARCH="$(go env GOARCH)"
|
|
|
|
TARGET="$TARGET/${GOOS}-${GOARCH}/docker-pps"
|
|
if [ "${GOOS}" = "windows" ]; then
|
|
TARGET="${TARGET}.exe"
|
|
fi
|
|
|
|
case "$1" in
|
|
fmt)
|
|
go fmt $(go list)
|
|
;;
|
|
clean)
|
|
rm -rf ./target
|
|
;;
|
|
build)
|
|
go build -o "${TARGET}"
|
|
;;
|
|
install)
|
|
go install
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {fmt|clean|build|install}"
|
|
exit 1
|
|
esac
|
|
|