Skip to content

Commit

Permalink
Use a version parameter in the linter install script (#1688)
Browse files Browse the repository at this point in the history
To avoid specifying the version of 'golangci-lint' in multiple places, it is now a parameter in the 'install-golangcilint.sh' script. With this change, the version of 'golangci-lint' is only declared in the Makefile.

Signed-off-by: Jan Schlicht <jan@d2iq.com>
  • Loading branch information
Jan Schlicht committed Sep 21, 2020
1 parent 248272f commit ff6a61d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BUILD_DATE_PATH := github.com/kudobuilder/kudo/pkg/version.buildDate
DATE_FMT := "%Y-%m-%dT%H:%M:%SZ"
BUILD_DATE := $(shell date -u -d "@$SOURCE_DATE_EPOCH" "+${DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "+${DATE_FMT}" 2>/dev/null || date -u "+${DATE_FMT}")
LDFLAGS := -X ${GIT_VERSION_PATH}=${GIT_VERSION:v%=%} -X ${GIT_COMMIT_PATH}=${GIT_COMMIT} -X ${BUILD_DATE_PATH}=${BUILD_DATE}
GOLANGCI_LINT_VER = "1.31.0"
GOLANGCI_LINT_VER = "v1.31.0"
SUPPORTED_PLATFORMS = amd64 arm64

export GO111MODULE=on
Expand Down Expand Up @@ -83,7 +83,7 @@ all: test manager ## Build manager and runs unit tests
.PHONY: lint
lint: ## Run golangci-lint
ifneq (${GOLANGCI_LINT_VER}, "$(shell golangci-lint version --format short 2>&1)")
./hack/install-golangcilint.sh
./hack/install-golangcilint.sh ${GOLANGCI_LINT_VER}
endif
golangci-lint --timeout 3m run --allow-parallel-runners

Expand Down Expand Up @@ -188,7 +188,7 @@ generate-clean:
# used to update imports on project. NOT a linter.
imports:
ifneq (${GOLANGCI_LINT_VER}, "$(shell golangci-lint version --format short 2>&1)")
./hack/install-golangcilint.sh
./hack/install-golangcilint.sh ${GOLANGCI_LINT_VER}
endif
golangci-lint run --disable-all -E goimports --fix

Expand Down
2 changes: 1 addition & 1 deletion hack/install-golangcilint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -o errexit
set -o nounset
set -o pipefail

GOLANGCILINT_VERSION=${GOLANGCILINT_VERSION:-v1.31.0}
GOLANGCILINT_VERSION=$1

curl -sSfL "https://raw.githubusercontent.com/golangci/golangci-lint/${GOLANGCILINT_VERSION}/install.sh" | sh -s -- -b "$(go env GOPATH)/bin" "${GOLANGCILINT_VERSION}"

0 comments on commit ff6a61d

Please sign in to comment.