Skip to content

Commit 91fa52e

Browse files
committed
fix lint
1 parent 9009464 commit 91fa52e

File tree

8 files changed

+38
-40
lines changed

8 files changed

+38
-40
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ require (
3737
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
3838
github.com/fatih/color v1.7.0 // indirect
3939
github.com/ghodss/yaml v1.0.0 // indirect
40-
github.com/gmlewis/go-httpdebug v0.0.9 // indirect
4140
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
4241
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
4342
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
@@ -76,10 +75,11 @@ require (
7675
github.com/twmb/franz-go/pkg/kmsg v1.9.0 // indirect
7776
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
7877
go.uber.org/atomic v1.11.0 // indirect
79-
golang.org/x/crypto v0.32.0 // indirect
78+
golang.org/x/crypto v0.36.0 // indirect
8079
golang.org/x/mod v0.20.0 // indirect
81-
golang.org/x/sys v0.29.0 // indirect
82-
golang.org/x/term v0.28.0 // indirect
80+
golang.org/x/net v0.38.0 // indirect
81+
golang.org/x/sys v0.31.0 // indirect
82+
golang.org/x/term v0.30.0 // indirect
8383
google.golang.org/protobuf v1.35.1 // indirect
8484
)
8585

go.sum

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4
6969
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
7070
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
7171
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
72-
github.com/gmlewis/go-httpdebug v0.0.9 h1:zNweu7aEyDOL2bDt5tpwAMMNifai9YtAh479bZEML6g=
73-
github.com/gmlewis/go-httpdebug v0.0.9/go.mod h1:t6xDKFIjenEc4rouOt79Oo6N09EiHFgMjbCOiQnOnOc=
7472
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
7573
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
7674
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -253,16 +251,16 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
253251
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
254252
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
255253
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
256-
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
257-
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
254+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
255+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
258256
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
259257
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
260258
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
261259
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
262260
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
263261
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
264-
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
265-
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
262+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
263+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
266264
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
267265
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
268266
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -274,16 +272,16 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
274272
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
275273
golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
276274
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
277-
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
278-
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
275+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
276+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
279277
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
280-
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
281-
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
278+
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
279+
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
282280
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
283281
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
284282
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
285-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
286-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
283+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
284+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
287285
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
288286
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
289287
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

go.work.sum

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,25 @@ go.opentelemetry.io/otel/sdk v1.27.0 h1:mlk+/Y1gLPLn84U4tI8d3GNJmGT/eXe3ZuOXN9kT
130130
go.opentelemetry.io/otel/sdk v1.27.0/go.mod h1:Ha9vbLwJE6W86YstIywK2xFfPjbWlCuwPtMkKdz/Y4A=
131131
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
132132
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
133+
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
134+
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
133135
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
134136
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
135137
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
136138
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=
137139
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
138-
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
140+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
139141
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA=
140142
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
141143
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
142144
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw=
145+
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
146+
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
147+
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
148+
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
143149
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
150+
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
151+
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
144152
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
145153
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44=
146154
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

pkg/config/apiclient.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"golang.org/x/oauth2"
2828
"k8s.io/utils/clock"
2929

30-
dbg "github.com/gmlewis/go-httpdebug/httpdebug"
3130
"github.com/streamnative/streamnative-mcp-server/pkg/auth"
3231
"github.com/streamnative/streamnative-mcp-server/pkg/auth/cache"
3332
"github.com/streamnative/streamnative-mcp-server/pkg/auth/store"
@@ -198,14 +197,11 @@ func InitSNCloudLogClient(issuerData auth.Issuer, tokenStore store.Store) error
198197
}
199198

200199
tokenSource := oauth2.ReuseTokenSource(nil, tokenRefresher)
201-
b := dbg.New()
202-
b.RedactEntireJWT = false
203200
SNCloudLogClient = &http.Client{
204201
Timeout: 10 * time.Second,
205202
Transport: &oauth2.Transport{
206203
Source: tokenSource,
207-
// Base: http.DefaultTransport,
208-
Base: b,
204+
Base: http.DefaultTransport,
209205
},
210206
}
211207

pkg/mcp/context_utils.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ func SetContext(options *config.Options, instanceName, clusterName string) error
4242
return fmt.Errorf("failed to get API client: %v", err)
4343
}
4444

45-
instances, _, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarInstance(ctx, options.Organization).Execute()
45+
instances, instancesBody, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarInstance(ctx, options.Organization).Execute()
4646
if err != nil {
4747
return fmt.Errorf("failed to list pulsar instances: %v", err)
4848
}
49+
defer instancesBody.Body.Close()
4950

5051
var instance sncloud.ComGithubStreamnativeCloudApiServerPkgApisCloudV1alpha1PulsarInstance
5152
foundInstance := false
@@ -63,11 +64,11 @@ func SetContext(options *config.Options, instanceName, clusterName string) error
6364
return fmt.Errorf("Pulsar instance %s not found", instanceName)
6465
}
6566

66-
clusters, _, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
67+
clusters, clustersBody, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
6768
if err != nil {
6869
return fmt.Errorf("failed to list pulsar clusters: %v", err)
6970
}
70-
71+
defer clustersBody.Body.Close()
7172
var cluster sncloud.ComGithubStreamnativeCloudApiServerPkgApisCloudV1alpha1PulsarCluster
7273
foundCluster := false
7374
for _, c := range clusters.Items {
@@ -102,7 +103,6 @@ func SetContext(options *config.Options, instanceName, clusterName string) error
102103
return fmt.Errorf("failed to get issuer: %v", err)
103104
}
104105

105-
// tokenKey := buildTokenKey(options.Organization, clusterUID, myselfGrant.ClientCredentials.ClientEmail)
106106
tokenKey := issuer.Audience
107107

108108
accessToken := ""

pkg/mcp/prompts.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ func handleListPulsarClusters(ctx context.Context, _ mcp.GetPromptRequest) (*mcp
4545
return nil, fmt.Errorf("failed to get API client: %v", err)
4646
}
4747

48-
clusters, _, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
48+
clusters, clustersBody, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
4949
if err != nil {
5050
return nil, fmt.Errorf("failed to list pulsar clusters: %v", err)
5151
}
52+
defer clustersBody.Body.Close()
5253

5354
var messages = make(
5455
[]mcp.PromptMessage,
@@ -115,11 +116,11 @@ func handleReadPulsarCluster(ctx context.Context, request mcp.GetPromptRequest)
115116
return nil, fmt.Errorf("failed to get name: %v", err)
116117
}
117118

118-
clusters, _, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
119+
clusters, clustersBody, err := apiClient.CloudStreamnativeIoV1alpha1Api.ListCloudStreamnativeIoV1alpha1NamespacedPulsarCluster(ctx, options.Organization).Execute()
119120
if err != nil {
120121
return nil, fmt.Errorf("failed to list pulsar clusters: %v", err)
121122
}
122-
123+
defer clustersBody.Body.Close()
123124
var cluster sncloud.ComGithubStreamnativeCloudApiServerPkgApisCloudV1alpha1PulsarCluster
124125
for _, c := range clusters.Items {
125126
if *c.Metadata.Name == name {

pkg/mcp/streamnative_resources_log_tools.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type LogOptions struct {
9595
Since string
9696
Timestamp string
9797
Follow bool
98-
ReplicaID int
98+
replicaID int
9999
Previous bool
100100
InsecureSkipTLSVerifyBackend bool
101101
}
@@ -144,9 +144,9 @@ func handleStreamNativeResourcesLog(ctx context.Context, request mcp.CallToolReq
144144
size = "20"
145145
}
146146

147-
replicaId, hasReplicaId := optionalParam[int](request.Params.Arguments, "replica_id")
148-
if !hasReplicaId {
149-
replicaId = -1
147+
replicaID, hasreplicaID := optionalParam[int](request.Params.Arguments, "replica_id")
148+
if !hasreplicaID {
149+
replicaID = -1
150150
}
151151

152152
timestampStr, hasTimestamp := optionalParam[string](request.Params.Arguments, "timestamp")
@@ -188,7 +188,7 @@ func handleStreamNativeResourcesLog(ctx context.Context, request mcp.CallToolReq
188188
PulsarNamespace: namespace,
189189
Size: size,
190190
Follow: false, // we do not support follow as streaming in MCP yet.
191-
ReplicaID: replicaId,
191+
replicaID: replicaID,
192192
Previous: previousContainer,
193193
InsecureSkipTLSVerifyBackend: false,
194194
Since: sinceStr,
@@ -247,7 +247,7 @@ func (o *LogOptions) getLogs(client *http.Client, position int64,
247247
o.Timestamp,
248248
position,
249249
record,
250-
o.ReplicaID,
250+
o.replicaID,
251251
)
252252

253253
req, err := http.NewRequest("GET", url, nil)

pkg/mcp/utils.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,6 @@ func isInstanceValid(instance sncloud.ComGithubStreamnativeCloudApiServerPkgApis
221221
instance.Status.Auth.Oauth2.Audience != ""
222222
}
223223

224-
// buildTokenKey creates a unique key for storing the token in the cache
225-
func buildTokenKey(namespace, clusterUID, myselfGrant string) string {
226-
return fmt.Sprintf("%s-%s-%s-%s", KeyPrefix, namespace, clusterUID, myselfGrant)
227-
}
228-
229224
func hasCachedValidToken(cachedGrant *auth.AuthorizationGrant) (bool, error) {
230225
if cachedGrant == nil || cachedGrant.Token == nil {
231226
return false, nil

0 commit comments

Comments
 (0)