Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,7 @@ jobs:
with:
go-version: "1.24"
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: --enable bodyclose --enable copyloopvar --enable misspell --timeout 10m

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
run: ./scripts/lint.sh
semgrep:
name: semgrep
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ check:
go vet $(shell go list ./... | grep -v /vendor/)

lint:
golangci-lint run --enable bodyclose --enable copyloopvar --enable misspell --out-format=colored-line-number --timeout 10m
./scripts/lint.sh

test-failing:
CGO_ENABLED=0 go test -timeout=5m $(shell go list ./... | grep -v /vendor/) | grep FAIL
Expand Down
23 changes: 23 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail

GOLANGCI_LINT_VERSION="v2.11.4"
LINT_ARGS="--disable errcheck,staticcheck --enable bodyclose,copyloopvar,misspell --timeout 10m"
Comment thread
amanfcp marked this conversation as resolved.
Comment thread
cursor[bot] marked this conversation as resolved.

# Check if golangci-lint is installed and matches the required version.
if command -v golangci-lint &>/dev/null; then
INSTALLED=$(golangci-lint version 2>&1 || true)
if echo "$INSTALLED" | grep -q "${GOLANGCI_LINT_VERSION#v}"; then
echo "golangci-lint ${GOLANGCI_LINT_VERSION} found"
else
echo "golangci-lint version mismatch (want ${GOLANGCI_LINT_VERSION}, got: ${INSTALLED})"
echo "Installing golangci-lint ${GOLANGCI_LINT_VERSION}..."
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@"${GOLANGCI_LINT_VERSION}"
fi
else
echo "golangci-lint not found, installing ${GOLANGCI_LINT_VERSION}..."
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@"${GOLANGCI_LINT_VERSION}"
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
fi
Comment thread
amanfcp marked this conversation as resolved.

# shellcheck disable=SC2086
golangci-lint run ${LINT_ARGS}
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
Loading