Use unique versions in staggered versioner (fixes #1063)
This commit is contained in:
@@ -18,6 +18,7 @@ package versioner
|
||||
import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
)
|
||||
|
||||
// Inserts ~tag just before the extension of the filename.
|
||||
@@ -40,3 +41,17 @@ func filenameTag(path string) string {
|
||||
}
|
||||
return match[1]
|
||||
}
|
||||
|
||||
func uniqueSortedStrings(strings []string) []string {
|
||||
seen := make(map[string]struct{}, len(strings))
|
||||
unique := make([]string, 0, len(strings))
|
||||
for _, str := range strings {
|
||||
_, ok := seen[str]
|
||||
if !ok {
|
||||
seen[str] = struct{}{}
|
||||
unique = append(unique, str)
|
||||
}
|
||||
}
|
||||
sort.Strings(unique)
|
||||
return unique
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user