Skip to content

Commit de204f8

Browse files
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>
1 parent 9d00ecc commit de204f8

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

pkg/cmd/skills/publish/publish_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func TestPublishRun_UnsupportedHost(t *testing.T) {
164164
IO: ios,
165165
Dir: dir,
166166
GitClient: &git.Client{},
167-
HttpClient: func() (*http.Client, error) { return &http.Client{}, nil },
167+
HttpClient: func() (*http.Client, error) { return nil, nil },
168168
host: "acme.ghes.com",
169169
})
170170
require.ErrorContains(t, err, "supports only github.com")

pkg/cmd/skills/search/search.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -770,17 +770,15 @@ func fetchPrimaryPages(client *api.Client, host, query string, displayPage, disp
770770
return allItems, totalCount, nil
771771
}
772772

773-
// skillResultKey is a typed map key for deduplicating code search results
774-
// by (repo, namespace, skill name). All fields are lowercased for
775-
// case-insensitive comparison.
776-
type skillResultKey struct {
777-
repo string
778-
namespace string
779-
skillName string
780-
}
781-
782773
// deduplicateResults extracts unique (repo, namespace, skill name) triples from code search hits.
783774
func deduplicateResults(items []codeSearchItem) []skillResult {
775+
// skillResultKey is a typed map key that deduplicates by (repo, namespace,
776+
// skill name). All fields are lowercased for case-insensitive comparison.
777+
type skillResultKey struct {
778+
repo string
779+
namespace string
780+
skillName string
781+
}
784782
seen := make(map[skillResultKey]struct{})
785783
var results []skillResult
786784

0 commit comments

Comments
 (0)