-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Upgrade golangci-lint in CI runner and Makefile #4861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a8c5afa
6b5f57a
7d854b4
50ad0ab
5f1ea1e
c6a6c1c
e4792de
96c2de8
a269c22
2dd9d3b
4ebd548
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| GOLANGCI_LINT_VERSION="v2.11.4" | ||
|
|
||
| # TODO: Re-enable errcheck and staticcheck once pre-existing issues are resolved. | ||
| LINT_ARGS="--disable errcheck,staticcheck --enable bodyclose,copyloopvar,misspell --timeout 10m" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint version and args duplicated across two filesLow Severity The golangci-lint version ( Additional Locations (1)Reviewed by Cursor Bugbot for commit 4ebd548. Configure here. |
||
|
|
||
| GOBIN="$(go env GOPATH)/bin" | ||
| GOLANGCI_LINT="${GOBIN}/golangci-lint" | ||
|
|
||
| # Extract and compare the exact version to avoid substring matches (e.g. 2.11.4 matching 2.11.40). | ||
| check_version() { | ||
| local bin="$1" | ||
| local installed | ||
| installed=$("${bin}" version 2>&1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) | ||
| [[ "${installed}" == "${GOLANGCI_LINT_VERSION#v}" ]] | ||
| } | ||
|
|
||
| # Check PATH first, then fall back to GOPATH/bin, otherwise install. | ||
| if command -v golangci-lint &>/dev/null && check_version "$(command -v golangci-lint)"; then | ||
| GOLANGCI_LINT="$(command -v golangci-lint)" | ||
| echo "golangci-lint ${GOLANGCI_LINT_VERSION} found at ${GOLANGCI_LINT}" | ||
| elif [[ -x "${GOLANGCI_LINT}" ]] && check_version "${GOLANGCI_LINT}"; then | ||
| echo "golangci-lint ${GOLANGCI_LINT_VERSION} found at ${GOLANGCI_LINT}" | ||
| else | ||
| echo "Installing golangci-lint ${GOLANGCI_LINT_VERSION}..." | ||
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "${GOBIN}" "${GOLANGCI_LINT_VERSION}" | ||
| fi | ||
amanfcp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # shellcheck disable=SC2086 | ||
| "${GOLANGCI_LINT}" run ${LINT_ARGS} | ||


Uh oh!
There was an error while loading. Please reload this page.