Skip to content

Commit 8077d6c

Browse files
committed
fix lint
1 parent 489a92e commit 8077d6c

22 files changed

+268
-156
lines changed

.github/workflows/go.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit Tests
2+
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, windows-latest, macos-latest]
13+
14+
runs-on: ${{ matrix.os }}
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: "go.mod"
24+
25+
- name: Download dependencies
26+
run: go mod download
27+
28+
- name: Run unit tests
29+
run: go test -race ./...
30+
31+
- name: Build
32+
run: make build

.github/workflows/goreleaser.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: GoReleaser Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
8+
id-token: write
9+
attestations: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: "go.mod"
23+
24+
- name: Download dependencies
25+
run: go mod download
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
29+
with:
30+
distribution: goreleaser
31+
# GoReleaser version
32+
version: "~> v2"
33+
# Arguments to pass to GoReleaser
34+
args: release --clean
35+
workdir: .
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Generate signed build provenance attestations for workflow artifacts
40+
uses: actions/attest-build-provenance@v2
41+
with:
42+
subject-path: |
43+
dist/*.tar.gz
44+
dist/*.zip
45+
dist/*.txt

.github/workflows/project.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
- release/*
7+
paths:
8+
- '**'
9+
- '!docs/**'
10+
- '!README.md'
11+
- '!CONTRIBUTING.md'
12+
13+
env:
14+
GOPRIVATE: github.com/streamnative
15+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
16+
17+
jobs:
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Set up Git token
23+
run: |
24+
git config --global user.email "[email protected]"
25+
git config --global user.name "StreamNative Bot"
26+
git config --global url."https://streamnativebot:${ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"
27+
28+
- name: Check out code into the Go module directory
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version-file: 'go.mod'
35+
36+
- name: Docker login
37+
run: docker login -u="${{ secrets.DOCKER_USER }}" -p="${{ secrets.DOCKER_PASSWORD }}"
38+
39+
- name: Run GoReleaser (snapshot)
40+
uses: goreleaser/goreleaser-action@v3
41+
with:
42+
version: latest
43+
args: release --snapshot --clean
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: dist
51+
path: dist/

pkg/mcp/context_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func handleSetContext(ctx context.Context, request mcp.CallToolRequest) (*mcp.Ca
9393
return mcp.NewToolResultText("StreamNative Cloud context set successfully"), nil
9494
}
9595

96-
func handleAvailableContexts(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
96+
func handleAvailableContexts(ctx context.Context, _ mcp.CallToolRequest) (*mcp.CallToolResult, error) {
9797
promptResponse, err := handleListPulsarClusters(ctx, mcp.GetPromptRequest{})
9898
if err != nil || promptResponse == nil {
9999
return mcp.NewToolResultError(fmt.Sprintf("Failed to list pulsar clusters: %v", err)), nil

pkg/mcp/pulsar_admin_brokers_stats_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func PulsarAdminAddBrokerStatsTools(s *server.MCPServer, readOnly bool, features
4646

4747
// handleBrokerStats returns a function to handle broker stats requests
4848
func handleBrokerStats(_ bool) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
49-
return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
49+
return func(_ context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
5050
client, err := pulsar.GetAdminClient()
5151
if err != nil {
5252
return mcp.NewToolResultError(fmt.Sprintf("Failed to get admin client: %v", err)), nil

pkg/mcp/pulsar_admin_brokers_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func PulsarAdminAddBrokersTools(s *server.MCPServer, readOnly bool, features []s
7272

7373
// Return a handler function, with readOnly state captured in closure
7474
func handleBrokerTool(readOnly bool) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
75-
return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
75+
return func(_ context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
7676
client, err := pulsar.GetAdminClient()
7777
if err != nil {
7878
return mcp.NewToolResultError(fmt.Sprintf("Failed to get admin client: %v", err)), nil

pkg/mcp/pulsar_admin_cluster_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func PulsarAdminAddClusterTools(s *server.MCPServer, readOnly bool, features []s
7777

7878
// handleClusterTool returns a function to handle cluster tool requests
7979
func handleClusterTool(readOnly bool) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
80-
return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
80+
return func(_ context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
8181
client, err := pulsar.GetAdminClient()
8282
if err != nil {
8383
return mcp.NewToolResultError(fmt.Sprintf("Failed to get admin client: %v", err)), nil

pkg/mcp/pulsar_admin_functions_tools.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func PulsarAdminAddFunctionsTools(s *server.MCPServer, readOnly bool, features [
120120
}
121121

122122
// handleFunctionsTool returns a handler function for the unified functions tool
123-
func handleFunctionsTool(readOnly bool) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
123+
func handleFunctionsTool(readOnly bool) func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
124124
return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
125125
// Create Pulsar client with API version V3
126126
client := cmdutils.NewPulsarClientWithAPIVersion(config.V3)
@@ -222,7 +222,7 @@ func handleFunctionsTool(readOnly bool) func(context.Context, mcp.CallToolReques
222222
}
223223

224224
// handleFunctionList handles listing all functions under a namespace
225-
func handleFunctionList(ctx context.Context, client cmdutils.Client, tenant, namespace string) (*mcp.CallToolResult, error) {
225+
func handleFunctionList(_ context.Context, client cmdutils.Client, tenant, namespace string) (*mcp.CallToolResult, error) {
226226
// Get function list
227227
functions, err := client.Functions().GetFunctions(tenant, namespace)
228228
if err != nil {
@@ -240,7 +240,7 @@ func handleFunctionList(ctx context.Context, client cmdutils.Client, tenant, nam
240240
}
241241

242242
// handleFunctionGet handles getting information about a function
243-
func handleFunctionGet(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
243+
func handleFunctionGet(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
244244
// Get function info
245245
functionConfig, err := client.Functions().GetFunction(tenant, namespace, name)
246246
if err != nil {
@@ -258,7 +258,7 @@ func handleFunctionGet(ctx context.Context, client cmdutils.Client, tenant, name
258258
}
259259

260260
// handleFunctionStatus handles getting the status of a function
261-
func handleFunctionStatus(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
261+
func handleFunctionStatus(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
262262
// Get function status
263263
status, err := client.Functions().GetFunctionStatus(tenant, namespace, name)
264264
if err != nil {
@@ -276,7 +276,7 @@ func handleFunctionStatus(ctx context.Context, client cmdutils.Client, tenant, n
276276
}
277277

278278
// handleFunctionStats handles getting the statistics of a function
279-
func handleFunctionStats(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
279+
func handleFunctionStats(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
280280
// Get function stats
281281
stats, err := client.Functions().GetFunctionStats(tenant, namespace, name)
282282
if err != nil {
@@ -294,7 +294,7 @@ func handleFunctionStats(ctx context.Context, client cmdutils.Client, tenant, na
294294
}
295295

296296
// handleFunctionQuerystate handles querying the state of a function
297-
func handleFunctionQuerystate(ctx context.Context, client cmdutils.Client, tenant, namespace, name, key string) (*mcp.CallToolResult, error) {
297+
func handleFunctionQuerystate(_ context.Context, client cmdutils.Client, tenant, namespace, name, key string) (*mcp.CallToolResult, error) {
298298
// Query function state
299299
state, err := client.Functions().GetFunctionState(tenant, namespace, name, key)
300300
if err != nil {
@@ -312,7 +312,7 @@ func handleFunctionQuerystate(ctx context.Context, client cmdutils.Client, tenan
312312
}
313313

314314
// handleFunctionCreate handles creating a new function
315-
func handleFunctionCreate(ctx context.Context, client cmdutils.Client, tenant, namespace, name string, arguments map[string]interface{}) (*mcp.CallToolResult, error) {
315+
func handleFunctionCreate(_ context.Context, client cmdutils.Client, tenant, namespace, name string, arguments map[string]interface{}) (*mcp.CallToolResult, error) {
316316
// Extract required parameters
317317
classname, err := requiredParam[string](arguments, "classname")
318318
if err != nil {
@@ -375,7 +375,7 @@ func handleFunctionCreate(ctx context.Context, client cmdutils.Client, tenant, n
375375
}
376376

377377
// handleFunctionUpdate handles updating an existing function
378-
func handleFunctionUpdate(ctx context.Context, client cmdutils.Client, tenant, namespace, name string, arguments map[string]interface{}) (*mcp.CallToolResult, error) {
378+
func handleFunctionUpdate(_ context.Context, client cmdutils.Client, tenant, namespace, name string, arguments map[string]interface{}) (*mcp.CallToolResult, error) {
379379
// Extract optional parameters
380380
classname, _ := optionalParam[string](arguments, "classname")
381381
inputTopics, _ := optionalParamArray[string](arguments, "inputs")
@@ -436,7 +436,7 @@ func handleFunctionUpdate(ctx context.Context, client cmdutils.Client, tenant, n
436436
}
437437

438438
// handleFunctionDelete handles deleting a function
439-
func handleFunctionDelete(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
439+
func handleFunctionDelete(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
440440
// Delete function
441441
err := client.Functions().DeleteFunction(tenant, namespace, name)
442442
if err != nil {
@@ -449,7 +449,7 @@ func handleFunctionDelete(ctx context.Context, client cmdutils.Client, tenant, n
449449
}
450450

451451
// handleFunctionStart handles starting a function
452-
func handleFunctionStart(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
452+
func handleFunctionStart(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
453453
// Start function
454454
err := client.Functions().StartFunction(tenant, namespace, name)
455455
if err != nil {
@@ -462,7 +462,7 @@ func handleFunctionStart(ctx context.Context, client cmdutils.Client, tenant, na
462462
}
463463

464464
// handleFunctionStop handles stopping a function
465-
func handleFunctionStop(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
465+
func handleFunctionStop(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
466466
// Stop function
467467
err := client.Functions().StopFunction(tenant, namespace, name)
468468
if err != nil {
@@ -475,7 +475,7 @@ func handleFunctionStop(ctx context.Context, client cmdutils.Client, tenant, nam
475475
}
476476

477477
// handleFunctionRestart handles restarting a function
478-
func handleFunctionRestart(ctx context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
478+
func handleFunctionRestart(_ context.Context, client cmdutils.Client, tenant, namespace, name string) (*mcp.CallToolResult, error) {
479479
// Restart function
480480
err := client.Functions().RestartFunction(tenant, namespace, name)
481481
if err != nil {
@@ -488,7 +488,7 @@ func handleFunctionRestart(ctx context.Context, client cmdutils.Client, tenant,
488488
}
489489

490490
// handleFunctionPutstate handles putting state into the state store of a function
491-
func handleFunctionPutstate(ctx context.Context, client cmdutils.Client, tenant, namespace, name, key, value string) (*mcp.CallToolResult, error) {
491+
func handleFunctionPutstate(_ context.Context, client cmdutils.Client, tenant, namespace, name, key, value string) (*mcp.CallToolResult, error) {
492492
// Create function state
493493
state := utils.FunctionState{
494494
Key: key,
@@ -507,7 +507,7 @@ func handleFunctionPutstate(ctx context.Context, client cmdutils.Client, tenant,
507507
}
508508

509509
// handleFunctionTrigger handles triggering a function
510-
func handleFunctionTrigger(ctx context.Context, client cmdutils.Client, tenant, namespace, name, topic, triggerValue string) (*mcp.CallToolResult, error) {
510+
func handleFunctionTrigger(_ context.Context, client cmdutils.Client, tenant, namespace, name, topic, triggerValue string) (*mcp.CallToolResult, error) {
511511
// Trigger function
512512
result, err := client.Functions().TriggerFunction(tenant, namespace, name, topic, triggerValue, "")
513513
if err != nil {

pkg/mcp/pulsar_admin_functions_worker_tools.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func PulsarAdminAddFunctionsWorkerTools(s *server.MCPServer, readOnly bool, feat
4646

4747
// handleFunctionsWorkerTool returns a function to handle functions worker tool requests
4848
func handleFunctionsWorkerTool(_ bool) func(context.Context, mcp.CallToolRequest) (*mcp.CallToolResult, error) {
49-
return func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
49+
return func(_ context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {
5050
// Create the admin client
5151
admin := pulsar.AdminClient
5252

0 commit comments

Comments
 (0)