fix: apply review feedback — nil HttpClient, local dedup type

- 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>
This commit is contained in:
Sam Morrow 2026-04-16 18:49:54 +02:00
parent 9d00ecc248
commit de204f8518
No known key found for this signature in database
2 changed files with 8 additions and 10 deletions

View file

@ -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")

View file

@ -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