Fix the CI lint gate and resolve golangci-lint findings (#20) #41
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
| # Copyright (c) 2026 dexpace and Omar Aljarrah. | |
| # Licensed under the MIT License. See LICENSE in the repository root for details. | |
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: test (go ${{ matrix.go }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go: ["1.26"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| check-latest: true | |
| - name: Verify modules are tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code -- go.mod go.sum | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Test (race + coverage) | |
| run: go test -race -covermode=atomic -coverprofile=coverage.out ./... | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.26" | |
| check-latest: true | |
| - name: Install golangci-lint | |
| # Build from source with the CI Go toolchain so the linter binary's Go | |
| # version matches the module's `go 1.26` directive. golangci-lint refuses | |
| # to run when it was built with an older Go than the target module, which | |
| # the prebuilt action binaries currently are. | |
| run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 | |
| - name: golangci-lint | |
| run: golangci-lint run ./... |