diff --git a/elock.go b/elock.go index 8cc011a..a4819c9 100644 --- a/elock.go +++ b/elock.go @@ -449,8 +449,12 @@ func List(options Options, timeout time.Duration) ([]*Record, error) { return nil, err } + path := options.Path + if len(path) == 0 || path[len(path)-1] != '/' { + path = path + "/" + } r, err := etcdClient.Query( - options.Path, + path, etcd.GET(), etcd.Recursive(true), etcd.Timeout(time.Minute), diff --git a/etcd/etcd.go b/etcd/etcd.go index b601d38..901b65d 100644 --- a/etcd/etcd.go +++ b/etcd/etcd.go @@ -8,7 +8,6 @@ import ( "log" "net/http" "net/url" - "path" "strconv" "sync" "time" @@ -247,7 +246,7 @@ func (client *Client) Query(key string, opts ...Option) (*Response, error) { QueryLoop: for { u, _ := url.Parse(endpoint) // error validated in client contructor - u.Path = path.Join("/v2/keys", key) + u.Path = "/v2/keys" + key q := &Request{ method: "GET", diff --git a/main/elock.go b/main/elock.go index ae5b609..28774c5 100644 --- a/main/elock.go +++ b/main/elock.go @@ -17,7 +17,7 @@ import ( ) const APP = "elock" -const VERSION = "0.3" +const VERSION = "0.3.1" type Config struct { EtcdEndpoints []string `json:"etcd-endpoints"`