preallocating slices (#904)
* preallocated some slices when size is known * gofmt * gofmt
This commit is contained in:
committed by
Asim Aslam
parent
2f3c251b00
commit
24b8d2a315
@@ -123,7 +123,7 @@ func (w *workersKV) List() ([]*store.Record, error) {
|
||||
return nil, errors.New(messages)
|
||||
}
|
||||
|
||||
var keys []string
|
||||
keys := make([]string, 0, len(a.Result))
|
||||
|
||||
for _, r := range a.Result {
|
||||
keys = append(keys, r.Name)
|
||||
|
||||
@@ -32,7 +32,7 @@ func (e *ekv) Read(keys ...string) ([]*store.Record, error) {
|
||||
values = append(values, keyval.Kvs...)
|
||||
}
|
||||
|
||||
var records []*store.Record
|
||||
records := make([]*store.Record, 0, len(values))
|
||||
|
||||
for _, kv := range values {
|
||||
records = append(records, &store.Record{
|
||||
|
||||
Reference in New Issue
Block a user