Skip to content

Commit

Permalink
CI: Use git diff to check 'go mod tidy', 'go fmt'
Browse files Browse the repository at this point in the history
Rather than capturing the output of these commands directly, we'll
inspect their effect on the working copy. This should provide more
useful information anyway.

Also, I decided to keep the "Install dependencies" step, even though 'go
mod tidy' will install everything. I think it's worth seeing what's used
by the main program vs. the tests and build tools.
  • Loading branch information
mbland committed Mar 27, 2023
1 parent acae8d6 commit 4f0f93e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ jobs:

- name: Check that go.mod is tidy
run: |
result="$(go mod tidy -x -v 2>&1)" && echo "$result" && [[ -z "$result" ]]
go mod tidy
result="$(git diff)" && echo "$result" && [[ -z "$result" ]]
- name: Run static checks
run: |
result="$(go fmt ./...)" && echo "$result" && [[ -z "$result" ]]
go fmt ./...
result="$(git diff)" && echo "$result" && [[ -z "$result" ]]
go vet ./...
go run honnef.co/go/tools/cmd/staticcheck ./...
Expand Down

0 comments on commit 4f0f93e

Please sign in to comment.