Skip to content
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

Run golangci-lint on generated files #396

Merged
merged 3 commits into from
May 10, 2023
Merged
Changes from all 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
11 changes: 7 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
${{ runner.os }}-go-
- name: gofmt
run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
- name: install deps
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
- name: generated files should not be modified
Expand All @@ -39,6 +35,13 @@ jobs:
git update-index --assume-unchanged go.mod
git update-index --assume-unchanged go.sum
if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi
# A hack to get golangci-lint to examine generated files
- name: remove "generated by" comments
run: find . -type f -name "*.go" -exec perl -i -pe 's/Code generated by .* DO NOT EDIT/FOO/g' {} \;
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m

test:
strategy:
Expand Down