diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index fa8e8524..e0d316ee 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,3 +1,4 @@ +--- name: tests defaults: @@ -32,6 +33,7 @@ jobs: uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - run: make build - run: make provider-services - run: make docker-image @@ -67,12 +69,8 @@ jobs: go-version: "${{ env.GOVERSION }}" - name: Setup direnv uses: HatsuneMiku3939/direnv-action@v1 - - run: make build - - run: make test-vet - - name: lint all - run: make test-lint-all - - name: lint make-sublinters - run: make test-sublinters + - name: Run linter + run: make lint release-dry-run: runs-on: ubuntu-latest diff --git a/.golangci.yaml b/.golangci.yaml index 69088480..bfc9bc12 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,3 +1,4 @@ +--- issues: exclude: - comment on exported (method|function|type|const|var) @@ -12,5 +13,25 @@ run: # Skip vendor/ etc skip-dirs-use-default: true - +linters: + disable-all: true + enable: + - unused + - misspell + - goerr113 + - gofmt + - gocritic + - goconst + - govet + - ineffassign + - unparam + - staticcheck + - revive + - gosec + - exportloopref + - prealloc linters-settings: + gocritic: + disabled-checks: + - ifElseChain + - singleCaseSwitch diff --git a/make/lint.mk b/make/lint.mk index 6a7729a2..93ff8e99 100644 --- a/make/lint.mk +++ b/make/lint.mk @@ -1,35 +1,7 @@ -SUBLINTERS = unused \ - misspell \ - goerr113 \ - gofmt \ - gocritic \ - goconst \ - ineffassign \ - unparam \ - staticcheck \ - revive \ - gosec \ - exportloopref \ - prealloc -# TODO: ^ gochecknoglobals +.PHONY: lint +lint: $(GOLANGCI_LINT) + $(GOLANGCI_LINT_RUN) ./... --issues-exit-code=0 --deadline=20m -# Execute the same lint methods as configured in .github/workflows/tests.yaml -# Clear feedback from each method as it fails. -.PHONY: test-sublinters -test-sublinters: $(patsubst %, test-sublinter-%,$(SUBLINTERS)) - -.PHONY: test-lint-all -test-lint-all: $(GOLANGCI_LINT) - $(GOLANGCI_LINT_RUN) ./... --issues-exit-code=0 --deadline=10m - -.PHONY: test-sublinter-misspell -test-sublinter-misspell: $(GOLANGCI_LINT) - $(LINT) misspell --no-config - -.PHONY: test-sublinter-ineffassign -test-sublinter-ineffassign: $(GOLANGCI_LINT) - $(LINT) ineffassign --no-config - -.PHONY: test-sublinter-% -test-sublinter-%: $(GOLANGCI_LINT) +.PHONY: lint-% +lint-%: $(GOLANGCI_LINT) $(LINT) $* diff --git a/make/test-integration.mk b/make/test-integration.mk index 2137449b..362f46ab 100644 --- a/make/test-integration.mk +++ b/make/test-integration.mk @@ -70,7 +70,3 @@ test-full: .PHONY: test-coverage test-coverage: $(AP_DEVCACHE) ./script/codecov.sh "$(AP_DEVCACHE_TESTS)" $(BUILD_TAGS_ALL) - -.PHONY: test-vet -test-vet: - $(GO_VET) ./...