#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd -P "$DIR/.." || exit 1
pwd

go test -coverprofile=coverage.txt -covermode=atomic ./...
go vet ./...

gofmt_errors=$(gofmt -e -l -d -s .)
if [ -n "$gofmt_errors" ]; then
    echo "Fmt failures on:"
    echo "$gofmt_errors"
    exit 1
fi

go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...

go mod tidy
gosumdiff="$(git diff go.sum)"
if [ -n "$gosumdiff" ]; then
    echo "Go.sum not up to date:"
    echo "$gosumdiff"
    exit 1
fi

#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd -P "$DIR/.." || exit 1
pwd

go test -coverprofile=coverage.txt -covermode=atomic ./...
go vet ./...

gofmt_errors=$(gofmt -e -l -d -s .)
if [ -n "$gofmt_errors" ]; then
    echo "Fmt failures on:"
    echo "$gofmt_errors"
    exit 1
fi

go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...

go mod tidy
gosumdiff="$(git diff go.sum)"
if [ -n "$gosumdiff" ]; then
    echo "Go.sum not up to date:"
    echo "$gosumdiff"
    exit 1
fi

--- 
+++ 
@@ -17,8 +17,8 @@
     exit 1
 fi
 
-go install golang.org/x/lint/golint@latest
-golint -set_exit_status ./...
+go install honnef.co/go/tools/cmd/staticcheck@latest
+staticcheck ./...
 
 go mod tidy
 gosumdiff="$(git diff go.sum)"
Use staticcheck instead of golint
