Skip to content

Commit

Permalink
Run script/lint like every other repo
Browse files Browse the repository at this point in the history
  • Loading branch information
nickstenning committed Apr 11, 2024
1 parent b7c875b commit 94f2a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions script/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected] run
fi
exec go run github.com/golangci/golangci-lint/cmd/[email protected] run "$@"

0 comments on commit 94f2a84

Please sign in to comment.