build, tests: replace golint w/ go vet + staticcheck

Goling is deprecated, as per their page [0]; its readme says that tools
such as `go vet` and `staticcheck` should be used instead.

As such, this patch replaces golint with the suggested tools.

[0] - https://github.com/golang/lint

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
This commit is contained in:
Miguel Duarte Barroso 2022-02-28 12:17:56 +01:00
parent 65e2f8b549
commit cd93d29352
2 changed files with 8 additions and 4 deletions

View File

@ -36,8 +36,8 @@ jobs:
- name: Run go vet
run: go vet ./...
- name: Install golint
run: GO111MODULE=off GOBIN=$(pwd)/bin go get golang.org/x/lint/golint
- name: Install static check
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Test
run: sudo PATH=${PATH}:./bin ./hack/test-go.sh

View File

@ -2,7 +2,11 @@
# single test: go test -v ./pkg/storage/
# without cache: go test -count=1 -v ./pkg/storage/
set -e -x
echo "Linting go code..."
golint ./cmd ./pkg
echo "Running go vet ..."
go vet ./cmd/... ./pkg/...
echo "Running golang staticcheck ..."
staticcheck ./...
echo "Running go tests..."
KUBEBUILDER_ASSETS="$(pwd)/bin" go test -v -covermode=count -coverprofile=coverage.out ./...