Commit 303e70db by Mario Trangoni

pkg/tsdb/elasticsearch/response_parser.go: simplify redundant code

$ gometalinter --vendor --disable-all --enable=megacheck --disable=gotype --deadline=6m ./...
pkg/tsdb/elasticsearch/response_parser.go:95:41:warning: should use make(map[string]string) instead (S1019) (megacheck)
pkg/tsdb/elasticsearch/response_parser.go:125:41:warning: should use make(map[string]string) instead (S1019) (megacheck)
pkg/tsdb/elasticsearch/response_parser.go:317:5:warning: redundant break statement (S1023) (megacheck)
pkg/tsdb/elasticsearch/response_parser.go:358:5:warning: redundant break statement (S1023) (megacheck)
parent b609d811
......@@ -92,7 +92,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu
} else {
for _, b := range esAgg.Get("buckets").MustArray() {
bucket := simplejson.NewFromAny(b)
newProps := make(map[string]string, 0)
newProps := make(map[string]string)
for k, v := range props {
newProps[k] = v
......@@ -122,7 +122,7 @@ func (rp *responseParser) processBuckets(aggs map[string]interface{}, target *Qu
for _, bucketKey := range bucketKeys {
bucket := simplejson.NewFromAny(buckets[bucketKey])
newProps := make(map[string]string, 0)
newProps := make(map[string]string)
for k, v := range props {
newProps[k] = v
......@@ -314,7 +314,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef
switch metric.Type {
case "count":
addMetricValue(&values, rp.getMetricName(metric.Type), castToNullFloat(bucket.Get("doc_count")))
break
case "extended_stats":
metaKeys := make([]string, 0)
meta := metric.Meta.MustMap()
......@@ -355,7 +354,6 @@ func (rp *responseParser) processAggregationDocs(esAgg *simplejson.Json, aggDef
}
addMetricValue(&values, metricName, castToNullFloat(bucket.GetPath(metric.ID, "value")))
break
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment