From 5da60cb239d2f2876f2431fdba2029b6dff64d52 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 19 Apr 2026 09:31:10 +0800 Subject: [PATCH] fix: remove unused functions Check, InsertSlice, GetLocalIp --- server/utils/utils.go | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/server/utils/utils.go b/server/utils/utils.go index c617c31b6..5ce187336 100644 --- a/server/utils/utils.go +++ b/server/utils/utils.go @@ -29,7 +29,6 @@ import ( "github.com/google/uuid" errors2 "github.com/pkg/errors" - "github.com/sirupsen/logrus" "golang.org/x/crypto/pbkdf2" ) @@ -196,12 +195,6 @@ func StringToInt(in string) (out int) { return } -func Check(f func() error) { - if err := f(); err != nil { - logrus.Error("Received error:", err) - } -} - func ParseNetReg(line string, reg *regexp.Regexp, shouldLen, index int) (int64, string, error) { rx1 := reg.FindStringSubmatch(line) if len(rx1) != shouldLen { @@ -368,29 +361,3 @@ func GetAvailablePort() (int, error) { }(l) return l.Addr().(*net.TCPAddr).Port, nil } - -func InsertSlice(index int, new []rune, src []rune) (ns []rune) { - ns = append(ns, src[:index]...) - ns = append(ns, new...) - ns = append(ns, src[index:]...) - return ns -} - -func GetLocalIp() (string, error) { - addrs, err := net.InterfaceAddrs() - - if err != nil { - return "", err - } - - for _, address := range addrs { - // 检查ip地址判断是否回环地址 - if ipNet, ok := address.(*net.IPNet); ok && !ipNet.IP.IsLoopback() { - if ipNet.IP.To4() != nil { - return ipNet.IP.String(), nil - } - } - } - - return "", errors.New("获取本机IP地址失败") -}