Skip to content

Instantly share code, notes, and snippets.

@030
Last active Apr 12, 2019
Embed
What would you like to do?
#!/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