From e1bf612ee80455b20ed92da43bd6e0092c16fac3 Mon Sep 17 00:00:00 2001 From: jiaxuanzhou Date: Tue, 27 Mar 2018 09:30:12 +0800 Subject: [PATCH 1/2] clientv3: optimize func NewFromURL --- clientv3/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clientv3/client.go b/clientv3/client.go index 238a88d41..227589b45 100644 --- a/clientv3/client.go +++ b/clientv3/client.go @@ -90,8 +90,8 @@ func NewCtxClient(ctx context.Context) *Client { } // NewFromURL creates a new etcdv3 client from a URL. -func NewFromURL(url string) (*Client, error) { - return New(Config{Endpoints: []string{url}}) +func NewFromURL(urls []string) (*Client, error) { + return New(Config{Endpoints: urls}) } // Close shuts down the client's etcd connections. From ad448fb28099269a8de4ca5426824b0dbbdb7b97 Mon Sep 17 00:00:00 2001 From: jiaxuanzhou Date: Tue, 27 Mar 2018 10:28:28 +0800 Subject: [PATCH 2/2] clientv3: keep NewFromURL the same, add method NewFromURLs --- clientv3/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clientv3/client.go b/clientv3/client.go index 227589b45..95afd1f66 100644 --- a/clientv3/client.go +++ b/clientv3/client.go @@ -90,7 +90,12 @@ func NewCtxClient(ctx context.Context) *Client { } // NewFromURL creates a new etcdv3 client from a URL. -func NewFromURL(urls []string) (*Client, error) { +func NewFromURL(url string) (*Client, error) { + return New(Config{Endpoints: []string{url}}) +} + +// NewFromURLs creates a new etcdv3 client from URLs. +func NewFromURLs(urls []string) (*Client, error) { return New(Config{Endpoints: urls}) }