diff --git a/.circleci/config.yml b/.circleci/config.yml index 677f1a57c..477f7f230 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,12 @@ jobs: steps: - *fast-checkout - run: make check-license-headers + golangci-lint: + <<: *defaults + steps: + - *fast-checkout + - run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.13.2 + - run: make golangci-lint test-build-arm: <<: *defaults steps: @@ -131,6 +137,9 @@ workflows: - check-license-headers: requires: - setup + - golangci-lint: + requires: + - setup - test-build-arm: requires: - setup @@ -158,6 +167,7 @@ workflows: requires: - linter - check-license-headers + - golangci-lint - test-golang-1.12 filters: tags: @@ -172,3 +182,4 @@ workflows: - linter - check-license-headers - test-golang-1.12 + - golangci-lint diff --git a/Makefile b/Makefile index 3fa415ccb..b3604dca9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build check-clean clean cover cover-viz default docker docker-build docker-test generate generate-protoc generate-pql gometalinter install install-build-deps install-gometalinter install-protoc install-protoc-gen-gofast install-peg prerelease prerelease-upload release release-build test +.PHONY: build check-clean clean cover cover-viz default docker docker-build docker-test generate generate-protoc generate-pql gometalinter install install-build-deps install-golangci-lint install-gometalinter install-protoc install-protoc-gen-gofast install-peg prerelease prerelease-upload release release-build test CLONE_URL=github.com/pilosa/pilosa VERSION := $(shell git describe --tags 2> /dev/null || echo unknown) @@ -131,6 +131,10 @@ docker-build: docker-test: docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) golang:$(GO_VERSION) go test -tags='$(BUILD_TAGS)' $(TESTFLAGS) ./... +# Run golangci-lint +golangci-lint: require-golangci-lint + golangci-lint run + # Run gometalinter with custom flags gometalinter: require-gometalinter vendor GO111MODULE=off gometalinter --vendor --disable-all \ @@ -185,6 +189,9 @@ install-protoc: install-peg: GO111MODULE=off go get github.com/pointlander/peg +install-golangci-lint: + go get -u github.com/golangci/golangci-lint/cmd/golangci-lint + install-gometalinter: GO111MODULE=off go get -u github.com/alecthomas/gometalinter GO111MODULE=off gometalinter --install