Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to index rather than copy indexing. #18494

Merged
merged 1 commit into from
Dec 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/labels/selector.go
Expand Up @@ -234,8 +234,8 @@ func (r *Requirement) String() string {
// Add adds requirements to the selector. It copies the current selector returning a new one
func (lsel internalSelector) Add(reqs ...Requirement) Selector {
var sel internalSelector
for _, item := range lsel {
sel = append(sel, item)
for ix := range lsel {
sel = append(sel, lsel[ix])
}
for _, r := range reqs {
sel = append(sel, r)
Expand All @@ -248,8 +248,8 @@ func (lsel internalSelector) Add(reqs ...Requirement) Selector {
// its Requirements match the input Labels. If any
// Requirement does not match, false is returned.
func (lsel internalSelector) Matches(l Labels) bool {
for _, req := range lsel {
if matches := req.Matches(l); !matches {
for ix := range lsel {
if matches := lsel[ix].Matches(l); !matches {
return false
}
}
Expand All @@ -260,8 +260,8 @@ func (lsel internalSelector) Matches(l Labels) bool {
// the internalSelector Requirements' human-readable strings.
func (lsel internalSelector) String() string {
var reqs []string
for _, req := range lsel {
reqs = append(reqs, req.String())
for ix := range lsel {
reqs = append(reqs, lsel[ix].String())
}
return strings.Join(reqs, ",")
}
Expand Down