etcdstore: fix missing errorcheck

This commit is contained in:
Benedict 2022-03-30 14:24:37 +02:00 committed by Benedict Schlüter
parent 3282995bda
commit 0718452bf9

View File

@ -90,13 +90,16 @@ func (s *EtcdStore) Put(request string, requestData []byte) error {
// Iterator returns an Iterator for a given prefix. // Iterator returns an Iterator for a given prefix.
func (s *EtcdStore) Iterator(prefix string) (Iterator, error) { func (s *EtcdStore) Iterator(prefix string) (Iterator, error) {
resp, err := s.client.Get(context.TODO(), etcdPrefix+prefix, clientv3.WithPrefix(), clientv3.WithKeysOnly()) resp, err := s.client.Get(context.TODO(), etcdPrefix+prefix, clientv3.WithPrefix(), clientv3.WithKeysOnly())
if err != nil {
return nil, err
}
keys := make([]string, 0, len(resp.Kvs)) keys := make([]string, 0, len(resp.Kvs))
for _, kv := range resp.Kvs { for _, kv := range resp.Kvs {
key := strings.TrimPrefix(string(kv.Key), etcdPrefix) key := strings.TrimPrefix(string(kv.Key), etcdPrefix)
keys = append(keys, key) keys = append(keys, key)
} }
output := &EtcdIterator{keys: keys} output := &EtcdIterator{keys: keys}
return output, err return output, nil
} }
// TODO: Implement this function, currently this function is never called. // TODO: Implement this function, currently this function is never called.