mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-09 21:55:29 +02:00
get rid of utils.Cut since we can now rely on strings.Cut instead
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user