Fix Labels/annotation logs and values.
This commit is contained in:
parent
077b39d7c6
commit
f084d2a28b
6 changed files with 27 additions and 37 deletions
|
@ -75,3 +75,19 @@ func ServiceLabel(key, serviceName string) string {
|
|||
}
|
||||
return key
|
||||
}
|
||||
|
||||
// SplitAndTrimString splits separatedString at the comma character and trims each
|
||||
// piece, filtering out empty pieces. Returns the list of pieces or nil if the input
|
||||
// did not contain a non-empty piece.
|
||||
func SplitAndTrimString(base string) []string {
|
||||
var trimmedStrings []string
|
||||
|
||||
for _, s := range strings.Split(base, ",") {
|
||||
s = strings.TrimSpace(s)
|
||||
if len(s) > 0 {
|
||||
trimmedStrings = append(trimmedStrings, s)
|
||||
}
|
||||
}
|
||||
|
||||
return trimmedStrings
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue