From eb5eb06341f74004a36af4026a463489581a9628 Mon Sep 17 00:00:00 2001 From: Manuel Martinez Date: Mon, 18 Aug 2025 09:11:25 -0700 Subject: [PATCH] ci: add go vet to lint step (#316) - Adds `go vet` call to the lint step in GA workflow. - Enforces a compatible `go-version` with the minimum in the matrix for the `test` step. - Fixes some minor `.yml` formatting Fixes #281 --- There's some discussion in #281 about adding [staticcheck](https://staticcheck.dev/docs/) as well but when I ran it, it found some hits (see below) that are presumably not severe, and I wouldn't want to block deployments before getting some feedback from maintainers. ``` internal/jsonrpc2/conn.go:695:4: this value of writeErr is never used (SA4006) internal/jsonrpc2/conn.go:697:5: this value of err is never used (SA4006) internal/jsonrpc2/conn.go:700:4: this value of err is never used (SA4006) mcp/mcp_test.go:501:2: var resource3 is unused (U1000) mcp/mcp_test.go:509:5: var embeddedResources is unused (U1000) mcp/mcp_test.go:513:6: func handleEmbeddedResource is unused (U1000) mcp/streamable.go:124:3: unnecessary assignment to the blank identifier (S1005) mcp/streamable.go:291:2: field lastStreamID is unused (U1000) mcp/streamable.go:293:2: field opts is unused (U1000) mcp/streamable_test.go:542:29: argument ctx is overwritten before first use (SA4009) ``` --- .github/workflows/test.yml | 66 ++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54b3633..5eb2dac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,7 +3,7 @@ on: # Manual trigger workflow_dispatch: push: - branches: main + branches: [main] pull_request: permissions: @@ -13,43 +13,47 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - - name: Check formatting - run: | - unformatted=$(gofmt -l .) - if [ -n "$unformatted" ]; then - echo "The following files are not properly formatted:" - echo "$unformatted" - exit 1 - fi - echo "All Go files are properly formatted" + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "^1.23" + - name: Check formatting + run: | + unformatted=$(gofmt -l .) + if [ -n "$unformatted" ]; then + echo "The following files are not properly formatted:" + echo "$unformatted" + exit 1 + fi + echo "All Go files are properly formatted" + - name: Run Go vet + run: go vet ./... test: runs-on: ubuntu-latest strategy: matrix: - go: [ '1.23', '1.24', '1.25.0-rc.3' ] + go: ["1.23", "1.24", "1.25.0-rc.3"] steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - name: Test - run: go test -v ./... + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + - name: Test + run: go test -v ./... race-test: runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: '1.24' - - name: Test with -race - run: go test -v -race ./... + - name: Check out code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + - name: Test with -race + run: go test -v -race ./...