Skip to content

Instantly share code, notes, and snippets.

@030
Last active April 12, 2019 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 030/9a74cf6537b32dfa666cdcbd9c0ccac7 to your computer and use it in GitHub Desktop.
Save 030/9a74cf6537b32dfa666cdcbd9c0ccac7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
readonly ARTIFACT_NAME=$1
formatting() {
echo "Go formatting..."
diff -u <(echo -n) <(gofmt -d ./)
}
version() {
echo "Checking the golang version..."
go version
}
go_test() {
ls
echo "Run the tests..."
go test -short -cover -v -coverprofile=coverage.out -covermode=atomic ./...
}
buid_and_checksum() {
LOCAL_DELIVERABLE="${ARTIFACT_NAME}-${1}${2}"
echo "Creating artifact ${LOCAL_DELIVERABLE}..."
env GOOS=$1 GOARCH=amd64 go build -o $LOCAL_DELIVERABLE
sha512sum $LOCAL_DELIVERABLE > ${LOCAL_DELIVERABLE}.sha512.txt
}
artifacts() {
buid_and_checksum darwin
buid_and_checksum linux
buid_and_checksum windows .exe
}
main() {
version
formatting
go_test
artifacts
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment