Skip to content

Commit 66cdefa

Browse files
committed
lint: fix if to case
1 parent d4e03a9 commit 66cdefa

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

pkg/github/actions_resource.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ func WorkflowRunLogsResourceHandler(getClient GetClientFn) func(ctx context.Cont
4545
return nil, errors.New("repo is required")
4646
}
4747

48-
runIdStr, ok := request.Params.Arguments["runId"].([]string)
49-
if !ok || len(runIdStr) == 0 {
48+
runIDStr, ok := request.Params.Arguments["runId"].([]string)
49+
if !ok || len(runIDStr) == 0 {
5050
return nil, errors.New("runId is required")
5151
}
5252

53-
runId, err := strconv.ParseInt(runIdStr[0], 10, 64)
53+
runID, err := strconv.ParseInt(runIDStr[0], 10, 64)
5454
if err != nil {
5555
return nil, fmt.Errorf("invalid runId: %w", err)
5656
}
@@ -61,7 +61,7 @@ func WorkflowRunLogsResourceHandler(getClient GetClientFn) func(ctx context.Cont
6161
}
6262

6363
// Get the JIT URL for workflow run logs
64-
url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, owner[0], repo[0], runId, 1)
64+
url, resp, err := client.Actions.GetWorkflowRunLogs(ctx, owner[0], repo[0], runID, 1)
6565
if err != nil {
6666
return nil, fmt.Errorf("failed to get workflow run logs URL: %w", err)
6767
}
@@ -77,7 +77,7 @@ func WorkflowRunLogsResourceHandler(getClient GetClientFn) func(ctx context.Cont
7777
mcp.TextResourceContents{
7878
URI: request.Params.URI,
7979
MIMEType: "application/zip",
80-
Text: fmt.Sprintf("Workflow run logs for run %d (ZIP archive)\n\nNote: This is a ZIP archive containing all job logs. Download URL was: %s\n\nContent length: %d bytes", runId, url.String(), len(content)),
80+
Text: fmt.Sprintf("Workflow run logs for run %d (ZIP archive)\n\nNote: This is a ZIP archive containing all job logs. Download URL was: %s\n\nContent length: %d bytes", runID, url.String(), len(content)),
8181
},
8282
}, nil
8383
}
@@ -97,12 +97,12 @@ func JobLogsResourceHandler(getClient GetClientFn) func(ctx context.Context, req
9797
return nil, errors.New("repo is required")
9898
}
9999

100-
jobIdStr, ok := request.Params.Arguments["jobId"].([]string)
101-
if !ok || len(jobIdStr) == 0 {
100+
jobIDStr, ok := request.Params.Arguments["jobId"].([]string)
101+
if !ok || len(jobIDStr) == 0 {
102102
return nil, errors.New("jobId is required")
103103
}
104104

105-
jobId, err := strconv.ParseInt(jobIdStr[0], 10, 64)
105+
jobID, err := strconv.ParseInt(jobIDStr[0], 10, 64)
106106
if err != nil {
107107
return nil, fmt.Errorf("invalid jobId: %w", err)
108108
}
@@ -113,7 +113,7 @@ func JobLogsResourceHandler(getClient GetClientFn) func(ctx context.Context, req
113113
}
114114

115115
// Get the JIT URL for job logs
116-
url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, owner[0], repo[0], jobId, 1)
116+
url, resp, err := client.Actions.GetWorkflowJobLogs(ctx, owner[0], repo[0], jobID, 1)
117117
if err != nil {
118118
return nil, fmt.Errorf("failed to get job logs URL: %w", err)
119119
}

pkg/github/repositories.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,20 +1671,21 @@ func handleFileContentsResourceLink(owner, repo, path, ref, sha string) (*mcp.Ca
16711671
description = fmt.Sprintf("File content for %s at commit %s in %s/%s", path, sha[:8], owner, repo)
16721672
case ref != "":
16731673
// Handle different ref types
1674-
if strings.HasPrefix(ref, "refs/heads/") {
1674+
switch {
1675+
case strings.HasPrefix(ref, "refs/heads/"):
16751676
branch := strings.TrimPrefix(ref, "refs/heads/")
16761677
resourceURI = fmt.Sprintf("repo://%s/%s/refs/heads/%s/contents%s", owner, repo, branch, path)
16771678
description = fmt.Sprintf("File content for %s on branch %s in %s/%s", path, branch, owner, repo)
1678-
} else if strings.HasPrefix(ref, "refs/tags/") {
1679+
case strings.HasPrefix(ref, "refs/tags/"):
16791680
tag := strings.TrimPrefix(ref, "refs/tags/")
16801681
resourceURI = fmt.Sprintf("repo://%s/%s/refs/tags/%s/contents%s", owner, repo, tag, path)
16811682
description = fmt.Sprintf("File content for %s at tag %s in %s/%s", path, tag, owner, repo)
1682-
} else if strings.HasPrefix(ref, "refs/pull/") && strings.HasSuffix(ref, "/head") {
1683+
case strings.HasPrefix(ref, "refs/pull/") && strings.HasSuffix(ref, "/head"):
16831684
// Extract PR number from refs/pull/{number}/head
16841685
prNumber := strings.TrimSuffix(strings.TrimPrefix(ref, "refs/pull/"), "/head")
16851686
resourceURI = fmt.Sprintf("repo://%s/%s/pulls/%s/contents%s", owner, repo, prNumber, path)
16861687
description = fmt.Sprintf("File content for %s in PR #%s in %s/%s", path, prNumber, owner, repo)
1687-
} else {
1688+
default:
16881689
// Generic ref handling - try to clean it up
16891690
cleanRef := strings.TrimPrefix(ref, "refs/")
16901691
resourceURI = fmt.Sprintf("repo://%s/%s/refs/%s/contents%s", owner, repo, cleanRef, path)

0 commit comments

Comments
 (0)