From ca6faed51ebbea1dab88af76dc7cce16386777ce Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw)" <3293172751nss@gmail.com> Date: Sat, 7 Oct 2023 13:08:47 +0800 Subject: [PATCH] fix: make lint Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --- tools/component/component.go | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/tools/component/component.go b/tools/component/component.go index f71fd18c8..9aecfa704 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -120,24 +120,20 @@ func main() { os.Exit(1) } -func extractHost(urlStr string) (string, error) { - u, err := url.Parse(urlStr) - if err != nil { - return "", fmt.Errorf("unable to parse URL: %w", err) - } - +func exactIP(urll string) string { + u, _ := url.Parse(urll) host, _, err := net.SplitHostPort(u.Host) if err != nil { host = u.Host } - if strings.HasSuffix(host, ":") { - host = host[:len(host)-1] + host = host[0 : len(host)-1] } - - return host, nil + + return host } + func checkMysql() error { var sqlDB *sql.DB defer func() {