diff --git a/build.sh b/build.sh index 6d0ad2d..9afc70a 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ if [ -z ${CI+x} ]; then # Local build, not in CI, format source - go fmt . + gofmt -s -w . fi VERSION="$(git describe --tags --dirty --always)" diff --git a/test.sh b/test.sh index 66fd87b..02b9157 100755 --- a/test.sh +++ b/test.sh @@ -9,8 +9,8 @@ grep -En 'Background\([1-9]' ./*.go ./*/*.go && exit 1 # Compile test first ./build.sh -# Linting first -MISFORMATTED="$(gofmt -l .)" +# Linting +MISFORMATTED="$(gofmt -l -s .)" 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:" @@ -19,6 +19,10 @@ if [ -n "$MISFORMATTED" ]; then exit 1 fi +# FIXME: Add "go vet", catches fmt-placeholders-vs-args problems +# FIXME: Add https://staticcheck.io/docs/ +# FIXME: Add https://github.com/kisielk/errcheck + # Unit tests first go test -timeout 20s ./...