Enable gofmt code simplification (#4887)
This commit is contained in:
committed by
Daniel Nelson
parent
4a311830c6
commit
ee056278f5
@@ -402,7 +402,7 @@ func translate(m telegraf.Metric, prefix string) (*azureMonitorMetric, error) {
|
||||
Namespace: ns,
|
||||
DimensionNames: dimensionNames,
|
||||
Series: []*azureMonitorSeries{
|
||||
&azureMonitorSeries{
|
||||
{
|
||||
DimensionValues: dimensionValues,
|
||||
Min: min,
|
||||
Max: max,
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestBuildDimensions(t *testing.T) {
|
||||
|
||||
tagKeys := make([]string, len(testPoint.Tags()))
|
||||
i := 0
|
||||
for k, _ := range testPoint.Tags() {
|
||||
for k := range testPoint.Tags() {
|
||||
tagKeys[i] = k
|
||||
i += 1
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ func escapeObject(m map[string]interface{}) (string, error) {
|
||||
// We find all keys and sort them first because iterating a map in go is
|
||||
// randomized and we need consistent output for our unit tests.
|
||||
keys := make([]string, 0, len(m))
|
||||
for k, _ := range m {
|
||||
for k := range m {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
@@ -85,11 +85,11 @@ func TestBuildTags(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
[]*telegraf.Tag{
|
||||
&telegraf.Tag{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "two",
|
||||
},
|
||||
&telegraf.Tag{
|
||||
{
|
||||
Key: "three",
|
||||
Value: "four",
|
||||
},
|
||||
@@ -98,7 +98,7 @@ func TestBuildTags(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*telegraf.Tag{
|
||||
&telegraf.Tag{
|
||||
{
|
||||
Key: "aaa",
|
||||
Value: "bbb",
|
||||
},
|
||||
|
||||
@@ -244,7 +244,7 @@ func TestUDP_WriteWithRealConn(t *testing.T) {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
var total int
|
||||
for _, _ = range metrics {
|
||||
for range metrics {
|
||||
n, _, err := conn.ReadFrom(buf[total:])
|
||||
if err != nil {
|
||||
break
|
||||
|
||||
@@ -154,7 +154,7 @@ func (p *PrometheusClient) Start() error {
|
||||
}
|
||||
|
||||
registry := prometheus.NewRegistry()
|
||||
for collector, _ := range defaultCollectors {
|
||||
for collector := range defaultCollectors {
|
||||
switch collector {
|
||||
case "gocollector":
|
||||
registry.Register(prometheus.NewGoCollector())
|
||||
@@ -236,7 +236,7 @@ func (p *PrometheusClient) Expire() {
|
||||
for name, family := range p.fam {
|
||||
for key, sample := range family.Samples {
|
||||
if p.ExpirationInterval.Duration != 0 && now.After(sample.Expiration) {
|
||||
for k, _ := range sample.Labels {
|
||||
for k := range sample.Labels {
|
||||
family.LabelSet[k]--
|
||||
}
|
||||
delete(family.Samples, key)
|
||||
@@ -323,7 +323,7 @@ func CreateSampleID(tags map[string]string) SampleID {
|
||||
|
||||
func addSample(fam *MetricFamily, sample *Sample, sampleID SampleID) {
|
||||
|
||||
for k, _ := range sample.Labels {
|
||||
for k := range sample.Labels {
|
||||
fam.LabelSet[k]++
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user