From 9a60ea2494d3b69d86660110477e3b69ddac67ce Mon Sep 17 00:00:00 2001 From: Sargun Dhillon Date: Sat, 5 Dec 2020 19:19:54 -0800 Subject: [PATCH] Switch to using Makefile for lint This uses gobin in the Makefile for golint. Gobin allows for easier pinning of dependencies that are project specific, as in the actual gobin command invocation you can specify the version. --- .circleci/config.yml | 5 +---- .golangci.yml | 2 +- Makefile | 4 ++++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d7680bb2..6735264d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -16,12 +16,9 @@ jobs: - run: name: go vet command: V=1 CI=1 make vet - - run: - name: Install linters - command: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.32.2 && mv ./bin/* /go/bin/ - run: name: Lint - command: golangci-lint run ./... + command: make lint - run: name: Dependencies command: scripts/validate/gomod.sh diff --git a/.golangci.yml b/.golangci.yml index a57e3ba4b..2dd22ffc7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -23,4 +23,4 @@ issues: - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked # EXC0003 golint: False positive when tests are defined in package 'test' - - func name will be used as test\.Test.* by other packages, and that stutters; consider calling this \ No newline at end of file + - func name will be used as test\.Test.* by other packages, and that stutters; consider calling this diff --git a/Makefile b/Makefile index 2f56be13f..510c53593 100644 --- a/Makefile +++ b/Makefile @@ -192,3 +192,7 @@ envtest: kubebuilder_2.3.1_${TEST_OS}_${TEST_ARCH} .PHONY: fmt fmt: goimports -w $(shell go list -f '{{.Dir}}' ./...) + +.PHONY: lint +lint: $(gobin_tool) + gobin -run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.33.0 run ./...