Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions auklib/auklib.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,11 @@ func UniqueStrings(slice []string) []string {
var unique []string
m := make(map[string]bool)
for _, s := range slice {
s = strings.ToLower(s)
if !m[s] {
m[s] = true
unique = append(unique, s)
}
}
return unique
}

// ToLowerSlice lowers capitalization of every string in the given slice.
func ToLowerSlice(slice []string) []string {
var out []string
for _, s := range slice {
out = append(out, strings.ToLower(s))
}
return out
}
2 changes: 1 addition & 1 deletion window/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (w *Window) UnmarshalJSON(b []byte) error {
if len(conv.Labels) == 0 {
return fmt.Errorf("window(%s): window must have minimum of one label (found: %d)", w.Name, len(conv.Labels))
}
w.Labels = auklib.UniqueStrings(auklib.ToLowerSlice(conv.Labels))
w.Labels = auklib.UniqueStrings(conv.Labels)

w.Starts = conv.Starts
w.Expires = conv.Expires
Expand Down