ci: test go fix error #195
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Go | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: go build ./... | |
| - name: Test | |
| run: go test -race ./... | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.12.2 | |
| - name: Check for go fix suggestions | |
| run: | | |
| # When this repo moves to a Go version that supports `go fix -diff`, | |
| # this can be simplified back to checking the diff output directly. | |
| go fix ./... | |
| gofmt -w -r 'interface{} -> any' . | |
| if ! git diff --exit-code -- .; then | |
| echo "::error::go fix found modernization opportunities" | |
| echo "Run 'go fix ./...' locally and commit the changes." | |
| exit 1 | |
| fi | |
| echo "✓ No go fix suggestions - code is up to date." |