chore: Fix linter findings for `revive:enforce-map-style` in `plugins/outputs` (#15981)

This commit is contained in:
Paweł Żak 2024-10-16 12:36:53 +02:00 committed by GitHub
parent 809480ee59
commit ce0f4b0dc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 8 additions and 8 deletions

View File

@ -205,7 +205,7 @@ func (c *CloudWatchLogs) Connect() error {
c.Log.Debugf("Log stream %q...", c.lsSource)
}
c.ls = map[string]*logStreamContainer{}
c.ls = make(map[string]*logStreamContainer)
}
return nil

View File

@ -59,7 +59,7 @@ func uniqKeyFromTagList(ts []*telegraf.Tag) (k string) {
func newStream(ts []*telegraf.Tag) *Stream {
s := &Stream{
Logs: make([]Log, 0),
Labels: map[string]string{},
Labels: make(map[string]string, len(ts)),
}
for _, t := range ts {

View File

@ -26,11 +26,11 @@ import (
var sampleConfig string
func (s *MongoDB) getCollections(ctx context.Context) error {
s.collections = map[string]bson.M{}
collections, err := s.client.Database(s.MetricDatabase).ListCollections(ctx, bson.M{})
if err != nil {
return fmt.Errorf("unable to execute ListCollections: %w", err)
}
s.collections = make(map[string]bson.M, collections.RemainingBatchLength())
for collections.Next(ctx) {
var collection bson.M
if err = collections.Decode(&collection); err != nil {

View File

@ -103,7 +103,7 @@ func (a *NebiusCloudMonitoring) Init() error {
},
Timeout: time.Duration(a.Timeout),
}
tags := map[string]string{}
tags := make(map[string]string)
a.MetricOutsideWindow = selfstat.Register("nebius_cloud_monitoring", "metric_outside_window", tags)
return nil
}

View File

@ -15,7 +15,7 @@ type columnList struct {
func newColumnList() *columnList {
return &columnList{
indices: map[string]int{},
indices: make(map[string]int),
}
}
@ -65,7 +65,7 @@ type TableSource struct {
}
func NewTableSources(p *Postgresql, metrics []telegraf.Metric) map[string]*TableSource {
tableSources := map[string]*TableSource{}
tableSources := make(map[string]*TableSource)
for _, m := range metrics {
tsrc := tableSources[m.Name()]

View File

@ -6,7 +6,7 @@ import (
type Creator func() telegraf.Output
var Outputs = map[string]Creator{}
var Outputs = make(map[string]Creator)
func Add(name string, creator Creator) {
Outputs[name] = creator

View File

@ -107,7 +107,7 @@ func (a *YandexCloudMonitoring) Connect() error {
a.Log.Infof("Writing to Yandex.Cloud Monitoring URL: %s", a.EndpointURL)
tags := map[string]string{}
tags := make(map[string]string)
a.MetricOutsideWindow = selfstat.Register("yandex_cloud_monitoring", "metric_outside_window", tags)
return nil