mirror of
https://github.com/walles/moar.git
synced 2024-10-26 21:13:11 +03:00
Verify code formatting in ./test.sh
This commit is contained in:
parent
0795329ac5
commit
ede1a8cbb3
2
build.sh
2
build.sh
@ -2,7 +2,7 @@
|
||||
|
||||
if [ -z ${CI+x} ]; then
|
||||
# Local build, not in CI, format source
|
||||
go fmt ./... .
|
||||
go fmt .
|
||||
fi
|
||||
|
||||
VERSION="$(git describe --tags --dirty --always)"
|
||||
|
16
test.sh
16
test.sh
@ -6,6 +6,19 @@ set -e -o pipefail
|
||||
grep -En 'Foreground\([1-9]' ./*.go ./*/*.go && exit 1
|
||||
grep -En 'Background\([1-9]' ./*.go ./*/*.go && exit 1
|
||||
|
||||
# Compile test first
|
||||
./build.sh
|
||||
|
||||
# Linting first
|
||||
MISFORMATTED="$(gofmt -l .)"
|
||||
if [ -n "$MISFORMATTED" ]; then
|
||||
echo >&2 "==="
|
||||
echo >&2 "ERROR: The following files are not formatted, run './build.sh', './test.sh' or 'go fmt .' to fix:"
|
||||
echo >&2 "$MISFORMATTED"
|
||||
echo >&2 "==="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Unit tests first
|
||||
go test -timeout 20s github.com/walles/moar/m
|
||||
|
||||
@ -14,9 +27,6 @@ go test -timeout 20s github.com/walles/moar/m
|
||||
GOOS=linux GOARCH=386 ./build.sh
|
||||
GOOS=darwin GOARCH=amd64 ./build.sh
|
||||
|
||||
# Make sure we have a runnable binary for the current platform when done
|
||||
./build.sh
|
||||
|
||||
# Verify sending the output to a file
|
||||
RESULT="$(mktemp)"
|
||||
function cleanup {
|
||||
|
Loading…
Reference in New Issue
Block a user