mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Trimsplit Wasn't using separator, more efficient.
This commit is contained in:
@@ -37,10 +37,9 @@ func redirect(hostname string, w http.ResponseWriter, req *http.Request) {
|
|||||||
// slice of the substrings between the separator with all leading and trailing
|
// slice of the substrings between the separator with all leading and trailing
|
||||||
// white space removed, as defined by Unicode.
|
// white space removed, as defined by Unicode.
|
||||||
func trimsplit(s, sep string) []string {
|
func trimsplit(s, sep string) []string {
|
||||||
raw := strings.Split(s, ",")
|
trimmed := strings.Split(s, sep)
|
||||||
trimmed := make([]string, 0)
|
for i, r := range trimmed {
|
||||||
for _, r := range raw {
|
trimmed[i] = strings.TrimSpace(r)
|
||||||
trimmed = append(trimmed, strings.TrimSpace(r))
|
|
||||||
}
|
}
|
||||||
return trimmed
|
return trimmed
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user