Add golangci-lint to Makefile and CI config

This commit is contained in:
Cody Soyland 2019-02-01 20:44:49 -06:00 • committed by Seebs
parent 099dc2d4f3
commit 258646a7d5
2 changed files with 19 additions and 1 deletions

View file

@ -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

View file

@ -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