Skip to content

Commit

Permalink
rework: exhaustive, deadcode and gomod check
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-burghardt committed May 8, 2024
1 parent 8550d6d commit d4e2c41
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ jobs:
with:
version: v1.58
args: --timeout=5m

- name: ./gomod.sh
run: ./gomod.sh

- name: exhaustive github.com/nishanths/[email protected]
run: |
go install github.com/nishanths/exhaustive/cmd/[email protected]
exhaustive -default-signifies-exhaustive ./...
- name: deadcode golang.org/x/tools/cmd/[email protected]
run: |
go install golang.org/x/tools/cmd/[email protected]
output=$(deadcode -test ./...)
if [[ -n "$output" ]]; then
echo "🚨 Deadcode found:"
echo "$output"
exit 1
else
echo "✅ No deadcode found"
fi
build:
runs-on: ubuntu-latest
Expand Down
8 changes: 8 additions & 0 deletions gomod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/bash
set -e

go mod tidy
git diff --exit-code -- go.mod || (echo "Go file go.mod is dirty, update the file with 'go mod tidy' locally." && exit 1)
git diff --exit-code -- go.sum || (echo "Go file go.sum is dirty, update the file with 'go mod tidy' locally." && exit 1)
diff -u go.list <(go list -m all) || (echo "Go dependencies have changed, update the go.list file with 'go list -m all > go.list' locally." && exit 1)
go mod verify || (echo "One or more Go dependencies failed verification. Either a version is no longer available, or the author or someone else has modified the version so it no longer points to the same code." && exit 1)

0 comments on commit d4e2c41

Please sign in to comment.