mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
pkg/tsdb/elasticsearch/client/search_request.go: simplify loop with
append. $ gometalinter --vendor --disable-all --enable=megacheck --disable=gotype --deadline=6m ./... pkg/tsdb/elasticsearch/client/search_request.go:59:4⚠️ should replace loop with sr.Aggs = append(sr.Aggs, aggArray...) (S1011) (megacheck) pkg/tsdb/elasticsearch/client/search_request.go:303:4⚠️ should replace loop with agg.Aggregation.Aggs = append(agg.Aggregation.Aggs, childAggs...) (S1011) (megacheck)
This commit is contained in:
@@ -56,9 +56,7 @@ func (b *SearchRequestBuilder) Build() (*SearchRequest, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, agg := range aggArray {
|
||||
sr.Aggs = append(sr.Aggs, agg)
|
||||
}
|
||||
sr.Aggs = append(sr.Aggs, aggArray...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,9 +298,7 @@ func (b *aggBuilderImpl) Build() (AggArray, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, childAgg := range childAggs {
|
||||
agg.Aggregation.Aggs = append(agg.Aggregation.Aggs, childAgg)
|
||||
}
|
||||
agg.Aggregation.Aggs = append(agg.Aggregation.Aggs, childAggs...)
|
||||
}
|
||||
|
||||
aggs = append(aggs, agg)
|
||||
|
||||
Reference in New Issue
Block a user