Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8bc4e3

Browse files
committed
models: split auth with strings.SplitN
1 parent 4169d1e commit f8bc4e3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/models/etcd/etcdclient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func New(addrlist string, auth string, timeout time.Duration) (*Client, error) {
5151
}
5252

5353
if auth != "" {
54-
split := strings.Split(auth, ":")
54+
split := strings.SplitN(auth, ":", 2)
5555
if len(split) != 2 || split[0] == "" {
5656
return nil, errors.Errorf("invalid auth")
5757
}

pkg/models/zk/zkclient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func NewWithLogfunc(addrlist string, auth string, timeout time.Duration, logfunc
6060
logger: &zkLogger{logfunc},
6161
}
6262
if auth != "" {
63-
split := strings.Split(auth, ":")
63+
split := strings.SplitN(auth, ":", 2)
6464
if len(split) != 2 || split[0] == "" {
6565
return nil, errors.Errorf("invalid auth")
6666
}

0 commit comments

Comments
 (0)