♻️ 一些工具函数移动到 gulu 项目中

This commit is contained in:
Liang Ding 2022-06-23 19:35:59 +08:00
parent afbe434239
commit 705f34ccd1
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
10 changed files with 20 additions and 65 deletions

View file

@ -23,6 +23,8 @@ import (
"os/exec"
"path"
"strings"
"github.com/88250/gulu"
)
var (
@ -87,7 +89,7 @@ func GetLocalIPs() (ret []string) {
if "android" == Container {
// Android 上用不了 net.InterfaceAddrs() https://github.com/golang/go/issues/40569所以前面使用启动内核传入的参数 localIPs
LocalIPs = append(LocalIPs, "127.0.0.1")
LocalIPs = RemoveDuplicatedElem(LocalIPs)
LocalIPs = gulu.Str.RemoveDuplicatedElem(LocalIPs)
return LocalIPs
}
@ -104,7 +106,7 @@ func GetLocalIPs() (ret []string) {
}
}
ret = append(ret, "127.0.0.1")
ret = RemoveDuplicatedElem(ret)
ret = gulu.Str.RemoveDuplicatedElem(ret)
return
}