Skip to content

Commit 7305e1a

Browse files
committed
fix root path listing
1 parent ad4e506 commit 7305e1a

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

elock.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,12 @@ func List(options Options, timeout time.Duration) ([]*Record, error) {
449449
return nil, err
450450
}
451451

452+
path := options.Path
453+
if len(path) == 0 || path[len(path)-1] != '/' {
454+
path = path + "/"
455+
}
452456
r, err := etcdClient.Query(
453-
options.Path,
457+
path,
454458
etcd.GET(),
455459
etcd.Recursive(true),
456460
etcd.Timeout(time.Minute),

etcd/etcd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"log"
99
"net/http"
1010
"net/url"
11-
"path"
1211
"strconv"
1312
"sync"
1413
"time"
@@ -247,7 +246,7 @@ func (client *Client) Query(key string, opts ...Option) (*Response, error) {
247246
QueryLoop:
248247
for {
249248
u, _ := url.Parse(endpoint) // error validated in client contructor
250-
u.Path = path.Join("/v2/keys", key)
249+
u.Path = "/v2/keys" + key
251250

252251
q := &Request{
253252
method: "GET",

main/elock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
const APP = "elock"
20-
const VERSION = "0.3"
20+
const VERSION = "0.3.1"
2121

2222
type Config struct {
2323
EtcdEndpoints []string `json:"etcd-endpoints"`

0 commit comments

Comments
 (0)