Package list golang-github-go-kit-kit / a1cea4f
This fixes it; more detail incoming Peter Bourgon 5 years ago
1 changed file(s) with 10 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
121121 return nil, err
122122 }
123123
124 // Special case. Note that it's possible that len(resp.Node.Nodes) == 0 and
125 // resp.Node.Value is also empty, in which case the key is empty and we
126 // should not return any entries.
127 if len(resp.Node.Nodes) == 0 && resp.Node.Value != "" {
128 return []string{resp.Node.Value}, nil
129 }
130
124131 entries := make([]string, len(resp.Node.Nodes))
125
126 if len(entries) > 0 {
127 for i, node := range resp.Node.Nodes {
128 entries[i] = node.Value
129 }
130 } else {
131 entries = append(entries, resp.Node.Value)
132 for i, node := range resp.Node.Nodes {
133 entries[i] = node.Value
132134 }
133135 return entries, nil
134
135136 }
136137
137138 // WatchPrefix implements the etcd Client interface.
138139 func (c *client) WatchPrefix(prefix string, responseChan chan *etcd.Response) {
139140 watch := c.keysAPI.Watcher(prefix, &etcd.WatcherOptions{AfterIndex: 0, Recursive: true})
141 responseChan <- nil // TODO(pb) explain this
140142 for {
141143 res, err := watch.Next(c.ctx)
142144 if err != nil {