Skip to content

Commit

Permalink
Update lint action to catch any untidy go module (#44392) (#44457)
Browse files Browse the repository at this point in the history
* Update lint action to catch any untidy go module

Due to integrations/terraform and integrations/event-handler
importing teleport and replacing with ../.. any updates to
go.mod need to be kept in sync with the integrations modules.
The go mod tidiness check in the lint step only compared teleport
and the api modules, which allowed things to get out of sync and
possibly break integrations builds. The tidiness check now validates
that any go module in the repository is tidy.
  • Loading branch information
rosstimothy authored Jul 19, 2024
1 parent 1808bfe commit e4ceb0f
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit e4ceb0f

Please sign in to comment.