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) ```
This commit is contained in:
parent
1afdb1f273
commit
eb5eb06341
1 changed files with 35 additions and 31 deletions
66
.github/workflows/test.yml
vendored
66
.github/workflows/test.yml
vendored
|
|
@ -3,7 +3,7 @@ on:
|
||||||
# Manual trigger
|
# Manual trigger
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches: main
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -13,43 +13,47 @@ jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
- name: Check formatting
|
with:
|
||||||
run: |
|
go-version: "^1.23"
|
||||||
unformatted=$(gofmt -l .)
|
- name: Check formatting
|
||||||
if [ -n "$unformatted" ]; then
|
run: |
|
||||||
echo "The following files are not properly formatted:"
|
unformatted=$(gofmt -l .)
|
||||||
echo "$unformatted"
|
if [ -n "$unformatted" ]; then
|
||||||
exit 1
|
echo "The following files are not properly formatted:"
|
||||||
fi
|
echo "$unformatted"
|
||||||
echo "All Go files are properly formatted"
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "All Go files are properly formatted"
|
||||||
|
- name: Run Go vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: [ '1.23', '1.24', '1.25.0-rc.3' ]
|
go: ["1.23", "1.24", "1.25.0-rc.3"]
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ${{ matrix.go }}
|
go-version: ${{ matrix.go }}
|
||||||
- name: Test
|
- name: Test
|
||||||
run: go test -v ./...
|
run: go test -v ./...
|
||||||
|
|
||||||
race-test:
|
race-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
go-version: "1.24"
|
||||||
- name: Test with -race
|
- name: Test with -race
|
||||||
run: go test -v -race ./...
|
run: go test -v -race ./...
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue