workflows: run staticcheck on more platforms

To prevent issues like #1786, run staticcheck on the primary GOOSes:
linux, mac, and windows.

Windows also has a fair amount of GOARCH-specific code.
If we ever have GOARCH staticcheck failures on other GOOSes,
we can expand the test matrix further.

This requires installing the staticcheck binary so that
we can execute it with different GOOSes.

Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Josh Bleecher Snyder 2021-05-03 10:55:49 -07:00
parent 6d10655dc3
commit ac75958d2e
1 changed files with 16 additions and 4 deletions

View File

@ -24,11 +24,23 @@ jobs:
- name: Run go vet - name: Run go vet
run: go vet ./... run: go vet ./...
- name: Print staticcheck version - name: Install staticcheck
run: go run honnef.co/go/tools/cmd/staticcheck -version run: "GOBIN=~/.local/bin go install honnef.co/go/tools/cmd/staticcheck"
- name: Run staticcheck - name: Print staticcheck version
run: "go run honnef.co/go/tools/cmd/staticcheck -- $(go list ./... | grep -v tempfork)" run: "staticcheck -version"
- name: Run staticcheck (linux/amd64)
run: "GOOS=linux GOARCH=amd64 staticcheck -- $(go list ./... | grep -v tempfork)"
- name: Run staticcheck (darwin/amd64)
run: "GOOS=darwin GOARCH=amd64 staticcheck -- $(go list ./... | grep -v tempfork)"
- name: Run staticcheck (windows/amd64)
run: "GOOS=windows GOARCH=amd64 staticcheck -- $(go list ./... | grep -v tempfork)"
- name: Run staticcheck (windows/386)
run: "GOOS=windows GOARCH=386 staticcheck -- $(go list ./... | grep -v tempfork)"
- uses: k0kubun/action-slack@v2.0.0 - uses: k0kubun/action-slack@v2.0.0
with: with: