Skip to content

Commit 09f55f1

Browse files
use switch case instead of if
1 parent c8e270b commit 09f55f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/github/notifications.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,18 +171,18 @@ func DismissNotification(getclient GetClientFn, t translations.TranslationHelper
171171
}
172172

173173
var resp *github.Response
174-
175-
if state == "done" {
174+
switch state {
175+
case "done":
176176
// for some inexplicable reason, the API seems to have threadID as int64 and string depending on the endpoint
177177
var threadIDInt int64
178178
threadIDInt, err = strconv.ParseInt(threadID, 10, 64)
179179
if err != nil {
180180
return mcp.NewToolResultError(fmt.Sprintf("invalid threadID format: %v", err)), nil
181181
}
182182
resp, err = client.Activity.MarkThreadDone(ctx, threadIDInt)
183-
} else if state == "read" {
183+
case "read":
184184
resp, err = client.Activity.MarkThreadRead(ctx, threadID)
185-
} else {
185+
default:
186186
return mcp.NewToolResultError("Invalid state. Must be one of: read, done."), nil
187187
}
188188

0 commit comments

Comments
 (0)