get rid of utils.Cut since we can now rely on strings.Cut instead

This commit is contained in:
Kovid Goyal
2023-03-04 13:37:55 +05:30
parent defac0c061
commit a2887bb9e0
12 changed files with 24 additions and 35 deletions

View File

@@ -10,15 +10,8 @@ import (
"github.com/seancfoley/ipaddress-go/ipaddr"
)
func Cut(s string, sep string) (string, string, bool) {
if i := strings.Index(s, sep); i >= 0 {
return s[:i], s[i+len(sep):], true
}
return s, "", false
}
func ParseSocketAddress(spec string) (network string, addr string, err error) {
network, addr, found := Cut(spec, ":")
network, addr, found := strings.Cut(spec, ":")
if !found {
err = fmt.Errorf("Invalid socket address: %s must be prefix by a protocol such as unix:", spec)
return