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

[v14] Update lint action to catch any untidy go module #44457

Merged
merged 1 commit into from
Jul 19, 2024
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
16 changes: 11 additions & 5 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Run `go mod tidy`
run: rm go.sum api/go.sum && go mod tidy && (cd api && go mod tidy)
- name: Check for untidy go modules
shell: bash
run: |
find . -path ./e -prune -o -name go.mod -print | while read f; do
echo "checking $f"
pushd $(dirname "$f") > /dev/null;
go mod tidy;
popd > /dev/null;
done

- name: Check for no changes after `go mod tidy`
# We have to add the current directory as a safe directory or else git commands will not work as expected.
run: git config --global --add safe.directory $( realpath . ) && git diff --exit-code -- go.mod go.sum api/go.mod api/go.sum
# We have to add the current directory as a safe directory or else git commands will not work as expected.
git config --global --add safe.directory $( realpath . ) && git diff --exit-code;

- name: Set linter versions
run: |
Expand Down
Loading