Skip to content

Commit 3e68ce6

Browse files
committed
improve fetching of golangci-lint
1 parent d002559 commit 3e68ce6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

hack/check-everything.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,18 @@ function is_installed {
6666
return 1
6767
}
6868

69+
function golangci_lint_has_version {
70+
# Trim "v" from version prefix since golangci-lint --version
71+
# sometimes does not include it, depending on how it's built
72+
golangci-lint --version | grep --quiet --fixed-strings "${1#"v"}"
73+
}
74+
6975
function fetch_go_tools {
7076
header_text "Checking for golangci-lint"
71-
if ! is_installed golangci-lint; then
77+
local golangci_lint_version="v1.18.0"
78+
if ! is_installed golangci-lint || ! golangci_lint_has_version "${golangci_lint_version}"; then
7279
header_text "Installing golangci-lint"
73-
go get github.com/golangci/golangci-lint/cmd/[email protected]
80+
curl --location --silent --retry 5 --fail https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin "${golangci_lint_version}"
7481
fi
7582
}
7683

0 commit comments

Comments
 (0)