From 7ec55860e541e34056bc87f4288359691a179714 Mon Sep 17 00:00:00 2001 From: Wilken Rivera Date: Wed, 15 Apr 2020 06:53:51 -0400 Subject: [PATCH] Revert golangci-lint to use new-from-rev pinned at 1.23.8 (#9072) Turns out linting each file individually causes issues with the linter not being able to find the import types. --- Makefile | 3 ++- scripts/lint.sh | 6 ------ 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100755 scripts/lint.sh diff --git a/Makefile b/Makefile index 0b22f62e4..5b8cf0abd 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,7 @@ install-gen-deps: ## Install dependencies for code generation @go install ./cmd/mapstructure-to-hcl2 install-lint-deps: ## Install linter dependencies + # Pinning golangci-lint at v1.23.8 as --new-from-rev seems to work properly; the latest 1.24.0 has caused issues with memory consumption @echo "==> Updating linter dependencies..." @curl -sSfL -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.23.8 @@ -86,7 +87,7 @@ lint: install-lint-deps ## Lint Go code ci-lint: install-lint-deps ## On ci only lint newly added Go source files @echo "==> Running linter on newly added Go source files..." - @GO111MODULE=on sh -c "$(CURDIR)/scripts/lint.sh" + GO111MODULE=on golangci-lint run --new-from-rev=$(shell git merge-base origin/master HEAD) ./... fmt: ## Format Go code @go fmt ./... diff --git a/scripts/lint.sh b/scripts/lint.sh deleted file mode 100755 index cfe0e6baa..000000000 --- a/scripts/lint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -CHANGED_FILES=$(git diff --name-status `git merge-base origin/master HEAD`...HEAD | grep '^A.*\.go$'| awk '{print $2}') -if [ ! -z "${CHANGED_FILES}" ]; then - echo $CHANGED_FILES | xargs -n1 golangci-lint run -fi