diff --git a/.cirrus.yml b/.cirrus.yml index be1a7b96..9375737f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -53,6 +53,7 @@ validate_task: cpu: 4 memory: 8 script: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 make validate-local make vendor && hack/tree_status.sh @@ -91,7 +92,7 @@ osx_task: export PATH=$GOPATH/bin:$PATH brew update brew install gpgme go go-md2man - go install golang.org/x/lint/golint@latest + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2 test_script: | export PATH=$GOPATH/bin:$PATH go version diff --git a/Makefile b/Makefile index 79687d0f..d9f92581 100644 --- a/Makefile +++ b/Makefile @@ -227,7 +227,7 @@ test-all-local: validate-local validate-docs test-unit-local validate-local: hack/validate-git-marks.sh hack/validate-gofmt.sh - hack/validate-lint.sh + GOBIN=$(GOBIN) hack/validate-lint.sh BUILDTAGS="${BUILDTAGS}" hack/validate-vet.sh # This invokes bin/skopeo, hence cannot be run as part of validate-local diff --git a/hack/validate-lint.sh b/hack/validate-lint.sh index cc756902..d3dc7d11 100755 --- a/hack/validate-lint.sh +++ b/hack/validate-lint.sh @@ -1,27 +1,15 @@ #!/bin/bash -IFS=$'\n' -files=( $(find . -name '*.go' | grep -v '^\./vendor/' | sort || true) ) -unset IFS +errors=$($GOBIN/golangci-lint run --build-tags "${BUILDTAGS}" 2>&1) -errors=() -for f in "${files[@]}"; do - failedLint=$(golint "$f") - if [ "$failedLint" ]; then - errors+=( "$failedLint" ) - fi -done - -if [ ${#errors[@]} -eq 0 ]; then +if [ -z "$errors" ]; then echo 'Congratulations! All Go source files have been linted.' else { - echo "Errors from golint:" - for err in "${errors[@]}"; do - echo "$err" - done + echo "Errors from golangci-lint:" + echo "$errors" echo - echo 'Please fix the above errors. You can test via "golint" and commit the result.' + echo 'Please fix the above errors. You can test via "golangci-lint" and commit the result.' echo } >&2 exit 1