From c34502522161c03b31b79dd31ea7d1cd7e328fdc Mon Sep 17 00:00:00 2001 From: Mathias Bergqvist Date: Tue, 5 May 2026 09:02:39 +0200 Subject: [PATCH] fix(lint): staticcheck S1030, QF1002 and remove unused _ctx stub --- internal/tools/pr_files_diff.go | 2 +- internal/tools/pr_files_diff_test.go | 6 +++--- internal/tools/tool.go | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/internal/tools/pr_files_diff.go b/internal/tools/pr_files_diff.go index 74a6945..0400802 100644 --- a/internal/tools/pr_files_diff.go +++ b/internal/tools/pr_files_diff.go @@ -143,7 +143,7 @@ func splitUnifiedDiff(d []byte) map[string][]byte { flush := func() { if currentFile != "" { - m[currentFile] = []byte(current.String()) + m[currentFile] = current.Bytes() current.Reset() } } diff --git a/internal/tools/pr_files_diff_test.go b/internal/tools/pr_files_diff_test.go index 5824893..02bec0f 100644 --- a/internal/tools/pr_files_diff_test.go +++ b/internal/tools/pr_files_diff_test.go @@ -42,11 +42,11 @@ func buildFilesJSON(files []string, additions int) string { func newPRFilesDiffServer(t *testing.T, filesJSON, rawDiff string) *httptest.Server { t.Helper() return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch { - case r.URL.Path == "/api/v1/repos/o/r/pulls/1/files": + switch r.URL.Path { + case "/api/v1/repos/o/r/pulls/1/files": w.Header().Set("Content-Type", "application/json") _, _ = w.Write([]byte(filesJSON)) - case r.URL.Path == "/api/v1/repos/o/r/pulls/1.diff": + case "/api/v1/repos/o/r/pulls/1.diff": w.Header().Set("Content-Type", "text/plain") _, _ = w.Write([]byte(rawDiff)) default: diff --git a/internal/tools/tool.go b/internal/tools/tool.go index 17272b6..c4979b7 100644 --- a/internal/tools/tool.go +++ b/internal/tools/tool.go @@ -1,7 +1,6 @@ package tools import ( - "context" "encoding/json" "gitea.d-ma.be/mathias/gitea-mcp/internal/registry" @@ -21,8 +20,6 @@ func parseArgs(raw json.RawMessage, dst any) error { return json.Unmarshal(raw, dst) } -func _ctx(ctx context.Context) context.Context { return ctx } // stub for future hooks - // capLimit returns a sane page size: 0 or negative → def, > 50 → 50. func capLimit(in, def int) int { if in <= 0 {