Skip to content

Commit eb5eb06

Browse files
authored
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) ```
1 parent 1afdb1f commit eb5eb06

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

.github/workflows/test.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
# Manual trigger
44
workflow_dispatch:
55
push:
6-
branches: main
6+
branches: [main]
77
pull_request:
88

99
permissions:
@@ -13,43 +13,47 @@ jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Check out code
17-
uses: actions/checkout@v4
18-
- name: Set up Go
19-
uses: actions/setup-go@v5
20-
- name: Check formatting
21-
run: |
22-
unformatted=$(gofmt -l .)
23-
if [ -n "$unformatted" ]; then
24-
echo "The following files are not properly formatted:"
25-
echo "$unformatted"
26-
exit 1
27-
fi
28-
echo "All Go files are properly formatted"
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: "^1.23"
22+
- name: Check formatting
23+
run: |
24+
unformatted=$(gofmt -l .)
25+
if [ -n "$unformatted" ]; then
26+
echo "The following files are not properly formatted:"
27+
echo "$unformatted"
28+
exit 1
29+
fi
30+
echo "All Go files are properly formatted"
31+
- name: Run Go vet
32+
run: go vet ./...
2933

3034
test:
3135
runs-on: ubuntu-latest
3236
strategy:
3337
matrix:
34-
go: [ '1.23', '1.24', '1.25.0-rc.3' ]
38+
go: ["1.23", "1.24", "1.25.0-rc.3"]
3539
steps:
36-
- name: Check out code
37-
uses: actions/checkout@v4
38-
- name: Set up Go
39-
uses: actions/setup-go@v5
40-
with:
41-
go-version: ${{ matrix.go }}
42-
- name: Test
43-
run: go test -v ./...
40+
- name: Check out code
41+
uses: actions/checkout@v4
42+
- name: Set up Go
43+
uses: actions/setup-go@v5
44+
with:
45+
go-version: ${{ matrix.go }}
46+
- name: Test
47+
run: go test -v ./...
4448

4549
race-test:
4650
runs-on: ubuntu-latest
4751
steps:
48-
- name: Check out code
49-
uses: actions/checkout@v4
50-
- name: Set up Go
51-
uses: actions/setup-go@v5
52-
with:
53-
go-version: '1.24'
54-
- name: Test with -race
55-
run: go test -v -race ./...
52+
- name: Check out code
53+
uses: actions/checkout@v4
54+
- name: Set up Go
55+
uses: actions/setup-go@v5
56+
with:
57+
go-version: "1.24"
58+
- name: Test with -race
59+
run: go test -v -race ./...

0 commit comments

Comments
 (0)