From 70e260c04758588b47b4401c921da415551f2c47 Mon Sep 17 00:00:00 2001 From: Paddy Carver Date: Thu, 14 Feb 2019 02:41:59 -0800 Subject: [PATCH 1/2] Use golangci-lint instead of gometalinter. --- .golangci.yml | 26 ++++++++++++++++++++++++++ .gometalinter.json | 21 --------------------- .travis.yml | 3 +-- GNUmakefile | 8 ++++---- 4 files changed, 31 insertions(+), 27 deletions(-) create mode 100644 .golangci.yml delete mode 100644 .gometalinter.json diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000000..433ae75563 --- /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-beta/google-beta:Set + +run: + modules-download-mode: vendor diff --git a/.gometalinter.json b/.gometalinter.json deleted file mode 100644 index f19055ec59..0000000000 --- a/.gometalinter.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "Deadline": "10m", - "Enable": [ - "gofmt", - "misspell", - "staticcheck", - "structcheck", - "unconvert", - "varcheck", - "vet" - ], - "EnableGC": true, - "Linters": { - }, - "Sort": [ - "path", - "line" - ], - "Vendor": true, - "WarnUnmatchedDirective": true -} diff --git a/.travis.yml b/.travis.yml index 8c29147b5f..fe9acb0dcf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ language: go go: - "1.11.x" env: - - GO111MODULE=off + - GO111MODULE=on install: # This script is used by the Travis build to install a cookie for @@ -24,7 +24,6 @@ script: branches: only: - master - - 2.0.0 matrix: fast_finish: true allow_failures: diff --git a/GNUmakefile b/GNUmakefile index e7af6e548a..1469fa69d0 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -27,17 +27,17 @@ 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 ./$(DIR_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 \ echo "ERROR: Set TEST to a specific package. For example,"; \ - echo " make test-compile TEST=./$(PKG_NAME)"; \ + echo " make test-compile TEST=./$(DIR_NAME)"; \ exit 1; \ fi go test -c $(TEST) $(TESTARGS) From 24ae331d14a92ca1f9da99a27eb55dd1d3c62abe Mon Sep 17 00:00:00 2001 From: Paddy Carver Date: Thu, 14 Feb 2019 16:53:19 -0800 Subject: [PATCH 2/2] Set go flags to vendor. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index fe9acb0dcf..1f406a9b57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ go: - "1.11.x" env: - GO111MODULE=on + GOFLAGS=-mod=vendor install: # This script is used by the Travis build to install a cookie for