Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit57d2a42

Browse files
committed
refactor: update optionalParamsOK as exported member
1 parentc84e958 commit57d2a42

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

‎pkg/github/helper_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func TestOptionalParamOK(t *testing.T) {
162162

163163
// Test with string type assertion
164164
if_,isString:=tc.expectedVal.(string);isString||tc.errorMsg=="parameter myParam is not of type string, is bool" {
165-
val,ok,err:=optionalParamOK[string](request,tc.paramName)
165+
val,ok,err:=OptionalParamOK[string](request,tc.paramName)
166166
iftc.expectError {
167167
require.Error(t,err)
168168
assert.Contains(t,err.Error(),tc.errorMsg)
@@ -177,7 +177,7 @@ func TestOptionalParamOK(t *testing.T) {
177177

178178
// Test with bool type assertion
179179
if_,isBool:=tc.expectedVal.(bool);isBool||tc.errorMsg=="parameter myParam is not of type bool, is string" {
180-
val,ok,err:=optionalParamOK[bool](request,tc.paramName)
180+
val,ok,err:=OptionalParamOK[bool](request,tc.paramName)
181181
iftc.expectError {
182182
require.Error(t,err)
183183
assert.Contains(t,err.Error(),tc.errorMsg)
@@ -192,7 +192,7 @@ func TestOptionalParamOK(t *testing.T) {
192192

193193
// Test with float64 type assertion (for number case)
194194
if_,isFloat:=tc.expectedVal.(float64);isFloat {
195-
val,ok,err:=optionalParamOK[float64](request,tc.paramName)
195+
val,ok,err:=OptionalParamOK[float64](request,tc.paramName)
196196
iftc.expectError {
197197
// This case shouldn't happen for float64 in the defined tests
198198
require.Fail(t,"Unexpected error case for float64")

‎pkg/github/pullrequests.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,35 +118,35 @@ func UpdatePullRequest(client *github.Client, t translations.TranslationHelperFu
118118
update:=&github.PullRequest{}
119119
updateNeeded:=false
120120

121-
iftitle,ok,err:=optionalParamOK[string](request,"title");err!=nil {
121+
iftitle,ok,err:=OptionalParamOK[string](request,"title");err!=nil {
122122
returnmcp.NewToolResultError(err.Error()),nil
123123
}elseifok {
124124
update.Title=github.Ptr(title)
125125
updateNeeded=true
126126
}
127127

128-
ifbody,ok,err:=optionalParamOK[string](request,"body");err!=nil {
128+
ifbody,ok,err:=OptionalParamOK[string](request,"body");err!=nil {
129129
returnmcp.NewToolResultError(err.Error()),nil
130130
}elseifok {
131131
update.Body=github.Ptr(body)
132132
updateNeeded=true
133133
}
134134

135-
ifstate,ok,err:=optionalParamOK[string](request,"state");err!=nil {
135+
ifstate,ok,err:=OptionalParamOK[string](request,"state");err!=nil {
136136
returnmcp.NewToolResultError(err.Error()),nil
137137
}elseifok {
138138
update.State=github.Ptr(state)
139139
updateNeeded=true
140140
}
141141

142-
ifbase,ok,err:=optionalParamOK[string](request,"base");err!=nil {
142+
ifbase,ok,err:=OptionalParamOK[string](request,"base");err!=nil {
143143
returnmcp.NewToolResultError(err.Error()),nil
144144
}elseifok {
145145
update.Base=&github.PullRequestBranch{Ref:github.Ptr(base)}
146146
updateNeeded=true
147147
}
148148

149-
ifmaintainerCanModify,ok,err:=optionalParamOK[bool](request,"maintainer_can_modify");err!=nil {
149+
ifmaintainerCanModify,ok,err:=OptionalParamOK[bool](request,"maintainer_can_modify");err!=nil {
150150
returnmcp.NewToolResultError(err.Error()),nil
151151
}elseifok {
152152
update.MaintainerCanModify=github.Ptr(maintainerCanModify)

‎pkg/github/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ func GetMe(client *github.Client, t translations.TranslationHelperFunc) (tool mc
113113
}
114114
}
115115

116-
//optionalParamOK is a helper function that can be used to fetch a requested parameter from the request.
116+
//OptionalParamOK is a helper function that can be used to fetch a requested parameter from the request.
117117
// It returns the value, a boolean indicating if the parameter was present, and an error if the type is wrong.
118-
funcoptionalParamOK[Tany](r mcp.CallToolRequest,pstring) (valueT,okbool,errerror) {
118+
funcOptionalParamOK[Tany](r mcp.CallToolRequest,pstring) (valueT,okbool,errerror) {
119119
// Check if the parameter is present in the request
120120
val,exists:=r.Params.Arguments[p]
121121
if!exists {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp