diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 89461c1..07ad008 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -36,10 +36,8 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod - cache: false # for this job we rely on golangci-lint-action's cache - - name: Lint (other) + - run: go mod download + - name: Lint run: script/lint - - name: Lint (golangci-lint) - uses: golangci/golangci-lint-action@v4 - with: - version: v1.55.2 + - name: Formatting + run: CHECKONLY=1 script/format diff --git a/script/lint b/script/lint index 2ac09af..b7929c8 100755 --- a/script/lint +++ b/script/lint @@ -7,13 +7,14 @@ set -eu cd "$(dirname "$0")" cd .. +if [ "$GITHUB_ACTIONS" = "true" ]; then + set -- "$@" --out-format=github-actions +fi + go generate ./... if ! git diff --exit-code >/dev/null; then echo "Error: generated code is not up-to-date! Run 'go generate ./...' and update your branch." >&2 exit 1 fi -# On GitHub actions, this is run as a separate task -if [ "$GITHUB_ACTIONS" != "true" ]; then - exec go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run -fi +exec go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.57.2 run "$@"