Explorar o código

Trimsplit Wasn't using separator, more efficient.

Bjorn Tipling %!s(int64=12) %!d(string=hai) anos
pai
achega
ed2d7d64cd
Modificáronse 1 ficheiros con 3 adicións e 4 borrados
  1. 3 4
      server/util.go

+ 3 - 4
server/util.go

@@ -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
 // white space removed, as defined by Unicode.
 func trimsplit(s, sep string) []string {
-	raw := strings.Split(s, ",")
-	trimmed := make([]string, 0)
-	for _, r := range raw {
-		trimmed = append(trimmed, strings.TrimSpace(r))
+	trimmed := strings.Split(s, sep)
+	for i, r := range trimmed {
+		trimmed[i] = strings.TrimSpace(r)
 	}
 	return trimmed
 }