From e9c18aab73bcd1f3657b265855b4a9df0e95298d Mon Sep 17 00:00:00 2001 From: akostin Date: Fri, 11 May 2018 12:57:09 +0300 Subject: [PATCH] Strings.Fields() instead regex --- bt2qbt.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bt2qbt.go b/bt2qbt.go index e4729ab..cf442b0 100644 --- a/bt2qbt.go +++ b/bt2qbt.go @@ -14,7 +14,6 @@ import ( "log" "os" "path/filepath" - "regexp" "strconv" "strings" "time" @@ -210,17 +209,14 @@ func (newstructure *NewTorrentStructure) iflabel(label interface{}) { } func (newstructure *NewTorrentStructure) gettrackers(trackers interface{}) { - reg := regexp.MustCompile(`\s+`) switch strct := trackers.(type) { case []interface{}: for _, st := range strct { newstructure.gettrackers(st) } case string: - for _, str := range reg.Split(strct, -1) { - if len(str) != 0 { - newstructure.Trackers = append(newstructure.Trackers, []string{str}) - } + for _, str := range strings.Fields(strct) { + newstructure.Trackers = append(newstructure.Trackers, []string{str}) } }