Skip to content

refactor: replace manual contains helper with slices.Contains#79

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/refactor-codebase-structure
Draft

refactor: replace manual contains helper with slices.Contains#79
Copilot wants to merge 2 commits intomasterfrom
copilot/refactor-codebase-structure

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 24, 2026

pkg/hub/server/routes.go had hand-rolled contains and containsAll slice helpers that duplicate functionality available in the stdlib slices package since Go 1.21. This project targets Go 1.25.

Changes

  • Removed contains(set []string, e string) bool — replaced inline with slices.Contains
  • Updated containsAll to call slices.Contains directly
  • Added "slices" to imports
// Before
func contains(set []string, e string) bool {
    for _, s := range set {
        if s == e {
            return true
        }
    }
    return false
}

func containsAll(set []string, subset []string) bool {
    for _, se := range subset {
        if !contains(set, se) {
            return false
        }
    }
    return true
}

// After
func containsAll(set []string, subset []string) bool {
    for _, se := range subset {
        if !slices.Contains(set, se) {
            return false
        }
    }
    return true
}

No behavior change.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…es.go

Co-authored-by: btwiuse <54848194+btwiuse@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor codebase structure for improved maintainability refactor: replace manual contains helper with slices.Contains Feb 24, 2026
Copilot AI requested a review from btwiuse February 24, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants