Skip to content

Commit

Permalink
fix: label value duplication
Browse files Browse the repository at this point in the history
# Conflicts:
#	cmd/api-server/main.go
  • Loading branch information
vsukhin committed Apr 25, 2024
1 parent b63eb90 commit 0f956b1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions internal/app/api/v1/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ func (s TestkubeAPI) ListLabelsHandler() fiber.Handler {
}

for key, testValues := range nextLabels {
if values, ok := labels[key]; !ok {
labels[key] = testValues
} else {
valuesMap := map[string]struct{}{}
valuesMap := map[string]struct{}{}
if values, ok := labels[key]; ok {
for _, v := range values {
valuesMap[v] = struct{}{}
}
}

for _, label := range testValues {
if _, ok := valuesMap[label]; !ok {
labels[key] = append(labels[key], label)
valuesMap[label] = struct{}{}
}
for _, label := range testValues {
if _, ok := valuesMap[label]; !ok {
labels[key] = append(labels[key], label)
valuesMap[label] = struct{}{}
}
}
}
Expand Down

0 comments on commit 0f956b1

Please sign in to comment.