From 21499000ed3ac538038bf2a341fcdb1211bba6c8 Mon Sep 17 00:00:00 2001 From: Paddy Date: Thu, 14 Feb 2019 16:52:09 -0800 Subject: [PATCH] Switch to using golangci-lint instead of go-metalinter (#3049) * Switch to using golangci-lint instead of gometalinter. * Update list of allowed ignored errors. * Add GOFLAG=mod-vendor env var to travis. * Fix env vars. --- .golangci.yml | 26 ++++++++++++++++++++++++++ .travis.yml | 4 ++-- GNUmakefile | 7 ++++--- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 00000000..e31f3192 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,26 @@ +issues: + max-per-linter: 0 + max-same-issues: 0 + +linters: + disable-all: true + enable: + - deadcode + - errcheck + - gofmt + - gosimple + - ineffassign + - misspell + - staticcheck + - structcheck + - unconvert + - unused + - varcheck + - vet + +linters-settings: + errcheck: + ignore: github.com/hashicorp/terraform/helper/schema:ForceNew|Set,fmt:.*,io:Close,github.com/terraform-providers/terraform-provider-google/google:Set + +run: + modules-download-mode: vendor diff --git a/.travis.yml b/.travis.yml index 8c29147b..1f406a9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ language: go go: - "1.11.x" env: - - GO111MODULE=off + - GO111MODULE=on + GOFLAGS=-mod=vendor install: # This script is used by the Travis build to install a cookie for @@ -24,7 +25,6 @@ script: branches: only: - master - - 2.0.0 matrix: fast_finish: true allow_failures: diff --git a/GNUmakefile b/GNUmakefile index a81faea8..5a259868 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -26,12 +26,13 @@ fmtcheck: lint: @echo "==> Checking source code against linters..." - @bash -c "GO111MODULE=off gometalinter -d ./... 2> >(egrep '(^DEBUG.*linter took|^DEBUG.*total elapsed|^[^D])' >&2)" + @golangci-lint run ./$(PKG_NAME) tools: @echo "==> installing required tooling..." - GO111MODULE=off go get -u github.com/alecthomas/gometalinter - GO111MODULE=off gometalinter --install + GO111MODULE=off go get -u github.com/client9/misspell/cmd/misspell + GO111MODULE=off go get -u github.com/golangci/golangci-lint/cmd/golangci-lint + test-compile: @if [ "$(TEST)" = "./..." ]; then \