From a56e054d78ca3e15acbbe0786863b4e9ef9d2d77 Mon Sep 17 00:00:00 2001 From: Tingfeng Date: Thu, 21 Apr 2022 22:11:24 +0800 Subject: [PATCH] refactoring --- fasttld.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fasttld.go b/fasttld.go index 38deadc..4c057ac 100644 --- a/fasttld.go +++ b/fasttld.go @@ -193,7 +193,7 @@ func (f *FastTLD) Extract(e URLParams) *ExtractResult { maybePort string invalidPort bool ) - if hasPort := afterHost[0] == ':'; hasPort { + if afterHost[0] == ':' { if pathStartIndex == -1 { maybePort = afterHost[1:] } else { @@ -222,9 +222,8 @@ func (f *FastTLD) Extract(e URLParams) *ExtractResult { labels := strings.Split(netloc, ".") - var node *trie // define the root node - node = f.TldTrie + node := f.TldTrie var lenSuffix int var suffixCharCount int @@ -244,10 +243,9 @@ func (f *FastTLD) Extract(e URLParams) *ExtractResult { if len(val.matches) == 0 { urlParts.Domain = labels[idx-1] break - } else { - node = val - continue } + node = val + continue } }