From de204f85186f29189fd4ec584bd1d2fcc57f890e Mon Sep 17 00:00:00 2001 From: Sam Morrow Date: Thu, 16 Apr 2026 18:49:54 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20apply=20review=20feedback=20=E2=80=94=20?= =?UTF-8?q?nil=20HttpClient,=20local=20dedup=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Return nil instead of real http.Client in unsupported host test - Move skillResultKey type inside deduplicateResults function scope Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- pkg/cmd/skills/publish/publish_test.go | 2 +- pkg/cmd/skills/search/search.go | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pkg/cmd/skills/publish/publish_test.go b/pkg/cmd/skills/publish/publish_test.go index 04f400733..97795a617 100644 --- a/pkg/cmd/skills/publish/publish_test.go +++ b/pkg/cmd/skills/publish/publish_test.go @@ -164,7 +164,7 @@ func TestPublishRun_UnsupportedHost(t *testing.T) { IO: ios, Dir: dir, GitClient: &git.Client{}, - HttpClient: func() (*http.Client, error) { return &http.Client{}, nil }, + HttpClient: func() (*http.Client, error) { return nil, nil }, host: "acme.ghes.com", }) require.ErrorContains(t, err, "supports only github.com") diff --git a/pkg/cmd/skills/search/search.go b/pkg/cmd/skills/search/search.go index 18471cc95..05511484e 100644 --- a/pkg/cmd/skills/search/search.go +++ b/pkg/cmd/skills/search/search.go @@ -770,17 +770,15 @@ func fetchPrimaryPages(client *api.Client, host, query string, displayPage, disp return allItems, totalCount, nil } -// skillResultKey is a typed map key for deduplicating code search results -// by (repo, namespace, skill name). All fields are lowercased for -// case-insensitive comparison. -type skillResultKey struct { - repo string - namespace string - skillName string -} - // deduplicateResults extracts unique (repo, namespace, skill name) triples from code search hits. func deduplicateResults(items []codeSearchItem) []skillResult { + // skillResultKey is a typed map key that deduplicates by (repo, namespace, + // skill name). All fields are lowercased for case-insensitive comparison. + type skillResultKey struct { + repo string + namespace string + skillName string + } seen := make(map[skillResultKey]struct{}) var results []skillResult