From 4f0f93e061de87e249760e97c871d52bf05f02fb Mon Sep 17 00:00:00 2001 From: Mike Bland Date: Mon, 27 Mar 2023 17:11:51 -0400 Subject: [PATCH] CI: Use git diff to check 'go mod tidy', 'go fmt' 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. --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 029f752..8cdc82c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 ./...