From a6c214aec8b1e446fdb6499c8c06a918a3c871bc Mon Sep 17 00:00:00 2001 From: Pawel Zak Date: Thu, 5 Sep 2024 22:34:51 +0200 Subject: [PATCH] chore: Fix linter findings for `revive:enforce-repeated-arg-type-style` in `plugins/inputs/[a-g]*` --- plugins/inputs/aerospike/aerospike.go | 27 +++++++------------ plugins/inputs/aerospike/aerospike_test.go | 2 +- plugins/inputs/aliyuncms/aliyuncms.go | 4 +-- plugins/inputs/azure_monitor/azure_monitor.go | 5 +--- .../azure_monitor/azure_monitor_test.go | 2 +- plugins/inputs/beanstalkd/beanstalkd_test.go | 2 +- plugins/inputs/bond/bond.go | 6 ++--- .../cisco_telemetry_mdt.go | 9 +++++-- .../cloudwatch_metric_streams_test.go | 2 +- plugins/inputs/couchbase/couchbase.go | 4 +-- plugins/inputs/cpu/cpu_test.go | 3 +-- plugins/inputs/dcos/client.go | 2 +- .../directory_monitor/directory_monitor.go | 2 +- plugins/inputs/dns_query/dns_query.go | 2 +- plugins/inputs/docker/docker.go | 3 +-- plugins/inputs/docker/stats_helpers.go | 2 +- plugins/inputs/dovecot/dovecot.go | 6 ++--- plugins/inputs/dpdk/dpdk_utils.go | 2 +- plugins/inputs/ecs/ecs.go | 2 +- .../elasticsearch_query/aggregation_parser.go | 2 +- .../elasticsearch_query/aggregation_query.go | 2 +- plugins/inputs/exec/exec_test.go | 2 +- plugins/inputs/execd/shim/shim_test.go | 2 +- plugins/inputs/fibaro/hc2/parser.go | 2 +- plugins/inputs/fibaro/hc3/parser.go | 2 +- plugins/inputs/filecount/filecount_test.go | 2 +- plugins/inputs/github/github.go | 2 +- plugins/inputs/gnmi/gnmi.go | 2 +- .../google_cloud_storage_test.go | 2 +- plugins/inputs/graylog/graylog.go | 2 +- 30 files changed, 51 insertions(+), 58 deletions(-) diff --git a/plugins/inputs/aerospike/aerospike.go b/plugins/inputs/aerospike/aerospike.go index 22a775b4975fd..3dc552062fada 100644 --- a/plugins/inputs/aerospike/aerospike.go +++ b/plugins/inputs/aerospike/aerospike.go @@ -198,7 +198,7 @@ func (a *Aerospike) getNodeInfo(n *as.Node, infoPolicy *as.InfoPolicy) (map[stri return stats, nil } -func (a *Aerospike) parseNodeInfo(acc telegraf.Accumulator, stats map[string]string, hostPort string, nodeName string) { +func (a *Aerospike) parseNodeInfo(acc telegraf.Accumulator, stats map[string]string, hostPort, nodeName string) { nTags := map[string]string{ "aerospike_host": hostPort, "node_name": nodeName, @@ -239,7 +239,7 @@ func (a *Aerospike) getNamespaceInfo(namespace string, n *as.Node, infoPolicy *a return stats, err } -func (a *Aerospike) parseNamespaceInfo(acc telegraf.Accumulator, stats map[string]string, hostPort string, namespace string, nodeName string) { +func (a *Aerospike) parseNamespaceInfo(acc telegraf.Accumulator, stats map[string]string, hostPort, namespace, nodeName string) { nTags := map[string]string{ "aerospike_host": hostPort, "node_name": nodeName, @@ -304,7 +304,7 @@ func (a *Aerospike) getSetInfo(namespaceSet string, n *as.Node, infoPolicy *as.I return stats, nil } -func (a *Aerospike) parseSetInfo(acc telegraf.Accumulator, stats map[string]string, hostPort string, namespaceSet string, nodeName string) { +func (a *Aerospike) parseSetInfo(acc telegraf.Accumulator, stats map[string]string, hostPort, namespaceSet, nodeName string) { stat := strings.Split( strings.TrimSuffix( stats["sets/"+namespaceSet], ";"), ":") @@ -326,7 +326,7 @@ func (a *Aerospike) parseSetInfo(acc telegraf.Accumulator, stats map[string]stri acc.AddFields("aerospike_set", nFields, nTags, time.Now()) } -func (a *Aerospike) getTTLHistogram(acc telegraf.Accumulator, hostPort string, namespace string, set string, n *as.Node, infoPolicy *as.InfoPolicy) error { +func (a *Aerospike) getTTLHistogram(acc telegraf.Accumulator, hostPort, namespace, set string, n *as.Node, infoPolicy *as.InfoPolicy) error { stats, err := a.getHistogram(namespace, set, "ttl", n, infoPolicy) if err != nil { return err @@ -338,14 +338,7 @@ func (a *Aerospike) getTTLHistogram(acc telegraf.Accumulator, hostPort string, n return nil } -func (a *Aerospike) getObjectSizeLinearHistogram( - acc telegraf.Accumulator, - hostPort string, - namespace string, - set string, - n *as.Node, - infoPolicy *as.InfoPolicy, -) error { +func (a *Aerospike) getObjectSizeLinearHistogram(acc telegraf.Accumulator, hostPort, namespace, set string, n *as.Node, infoPolicy *as.InfoPolicy) error { stats, err := a.getHistogram(namespace, set, "object-size-linear", n, infoPolicy) if err != nil { return err @@ -357,7 +350,7 @@ func (a *Aerospike) getObjectSizeLinearHistogram( return nil } -func (a *Aerospike) getHistogram(namespace string, set string, histogramType string, n *as.Node, infoPolicy *as.InfoPolicy) (map[string]string, error) { +func (a *Aerospike) getHistogram(namespace, set, histogramType string, n *as.Node, infoPolicy *as.InfoPolicy) (map[string]string, error) { var queryArg string if len(set) > 0 { queryArg = fmt.Sprintf("histogram:type=%s;namespace=%v;set=%v", histogramType, namespace, set) @@ -372,7 +365,7 @@ func (a *Aerospike) getHistogram(namespace string, set string, histogramType str return stats, nil } -func (a *Aerospike) parseHistogram(acc telegraf.Accumulator, stats map[string]string, nTags map[string]string, histogramType string) { +func (a *Aerospike) parseHistogram(acc telegraf.Accumulator, stats, nTags map[string]string, histogramType string) { nFields := make(map[string]interface{}) for _, stat := range stats { @@ -422,12 +415,12 @@ func (a *Aerospike) parseHistogram(acc telegraf.Accumulator, stats map[string]st acc.AddFields(fmt.Sprintf("aerospike_histogram_%v", strings.ReplaceAll(histogramType, "-", "_")), nFields, nTags, time.Now()) } -func splitNamespaceSet(namespaceSet string) (namespace string, set string) { +func splitNamespaceSet(namespaceSet string) (namespace, set string) { split := strings.Split(namespaceSet, "/") return split[0], split[1] } -func parseAerospikeValue(key string, v string) interface{} { +func parseAerospikeValue(key, v string) interface{} { if protectedHexFields[key] { return v } else if parsed, err := strconv.ParseInt(v, 10, 64); err == nil { @@ -443,7 +436,7 @@ func parseAerospikeValue(key string, v string) interface{} { return v } -func createTags(hostPort string, nodeName string, namespace string, set string) map[string]string { +func createTags(hostPort, nodeName, namespace, set string) map[string]string { nTags := map[string]string{ "aerospike_host": hostPort, "node_name": nodeName, diff --git a/plugins/inputs/aerospike/aerospike_test.go b/plugins/inputs/aerospike/aerospike_test.go index 27efb3466a703..1f3090f7a23b9 100644 --- a/plugins/inputs/aerospike/aerospike_test.go +++ b/plugins/inputs/aerospike/aerospike_test.go @@ -473,7 +473,7 @@ func TestAerospikeParseValue(t *testing.T) { require.Equal(t, `1992929191`, val, "must be left as a string") } -func FindTagValue(acc *testutil.Accumulator, measurement string, key string, value string) bool { +func FindTagValue(acc *testutil.Accumulator, measurement, key, value string) bool { for _, p := range acc.Metrics { if p.Measurement == measurement { v, ok := p.Tags[key] diff --git a/plugins/inputs/aliyuncms/aliyuncms.go b/plugins/inputs/aliyuncms/aliyuncms.go index dfc3cdfac5c89..56203e567c413 100644 --- a/plugins/inputs/aliyuncms/aliyuncms.go +++ b/plugins/inputs/aliyuncms/aliyuncms.go @@ -342,7 +342,7 @@ func (s *AliyunCMS) gatherMetric(acc telegraf.Accumulator, metricName string, me } // tag helper -func parseTag(tagSpec string, data interface{}) (tagKey string, tagValue string, err error) { +func parseTag(tagSpec string, data interface{}) (tagKey, tagValue string, err error) { var ( ok bool queryPath = tagSpec @@ -474,7 +474,7 @@ L: } // Formatting helpers -func formatField(metricName string, statistic string) string { +func formatField(metricName, statistic string) string { if metricName == statistic { statistic = "value" } diff --git a/plugins/inputs/azure_monitor/azure_monitor.go b/plugins/inputs/azure_monitor/azure_monitor.go index 46806a560022a..495b67ec7d637 100644 --- a/plugins/inputs/azure_monitor/azure_monitor.go +++ b/plugins/inputs/azure_monitor/azure_monitor.go @@ -171,10 +171,7 @@ func (am *AzureMonitor) setReceiver() error { } func (acm *azureClientsManager) createAzureClients( - subscriptionID string, - clientID string, - clientSecret string, - tenantID string, + subscriptionID, clientID, clientSecret, tenantID string, clientOptions azcore.ClientOptions, ) (*receiver.AzureClients, error) { if clientSecret != "" { diff --git a/plugins/inputs/azure_monitor/azure_monitor_test.go b/plugins/inputs/azure_monitor/azure_monitor_test.go index ffbfc4adaa991..4bada838645b5 100644 --- a/plugins/inputs/azure_monitor/azure_monitor_test.go +++ b/plugins/inputs/azure_monitor/azure_monitor_test.go @@ -27,7 +27,7 @@ type mockAzureMetricDefinitionsClient struct{} type mockAzureMetricsClient struct{} -func (mam *mockAzureClientsManager) createAzureClients(_ string, _ string, _ string, _ string, _ azcore.ClientOptions) (*receiver.AzureClients, error) { +func (mam *mockAzureClientsManager) createAzureClients(_, _, _, _ string, _ azcore.ClientOptions) (*receiver.AzureClients, error) { return &receiver.AzureClients{ Ctx: context.Background(), ResourcesClient: &mockAzureResourcesClient{}, diff --git a/plugins/inputs/beanstalkd/beanstalkd_test.go b/plugins/inputs/beanstalkd/beanstalkd_test.go index 88c311103358d..204db8b7063ab 100644 --- a/plugins/inputs/beanstalkd/beanstalkd_test.go +++ b/plugins/inputs/beanstalkd/beanstalkd_test.go @@ -345,7 +345,7 @@ func getOverviewTags(server string) map[string]string { } } -func getTubeTags(server string, tube string) map[string]string { +func getTubeTags(server, tube string) map[string]string { return map[string]string{ "name": tube, "server": server, diff --git a/plugins/inputs/bond/bond.go b/plugins/inputs/bond/bond.go index cfcb4f3b45184..929d469510fe3 100644 --- a/plugins/inputs/bond/bond.go +++ b/plugins/inputs/bond/bond.go @@ -79,7 +79,7 @@ func (bond *Bond) Gather(acc telegraf.Accumulator) error { return nil } -func (bond *Bond) gatherBondInterface(bondName string, rawFile string, acc telegraf.Accumulator) error { +func (bond *Bond) gatherBondInterface(bondName, rawFile string, acc telegraf.Accumulator) error { splitIndex := strings.Index(rawFile, "Slave Interface:") if splitIndex == -1 { splitIndex = len(rawFile) @@ -98,7 +98,7 @@ func (bond *Bond) gatherBondInterface(bondName string, rawFile string, acc teleg return nil } -func (bond *Bond) gatherBondPart(bondName string, rawFile string, acc telegraf.Accumulator) error { +func (bond *Bond) gatherBondPart(bondName, rawFile string, acc telegraf.Accumulator) error { fields := make(map[string]interface{}) tags := map[string]string{ "bond": bondName, @@ -210,7 +210,7 @@ func (bond *Bond) gatherSysDetails(bondName string, files sysFiles, acc telegraf acc.AddFields("bond_sys", fields, tags) } -func (bond *Bond) gatherSlavePart(bondName string, rawFile string, acc telegraf.Accumulator) error { +func (bond *Bond) gatherSlavePart(bondName, rawFile string, acc telegraf.Accumulator) error { var slaveCount int tags := map[string]string{ "bond": bondName, diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go index f52533fcba24c..8f34c173126dc 100644 --- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go +++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go @@ -649,8 +649,13 @@ func (c *CiscoTelemetryMDT) getMeasurementName(encodingPath string) string { return measurement } -func (c *CiscoTelemetryMDT) parseContentField(grouper *metric.SeriesGrouper, field *telemetry.TelemetryField, prefix string, - encodingPath string, tags map[string]string, timestamp time.Time) { +func (c *CiscoTelemetryMDT) parseContentField( + grouper *metric.SeriesGrouper, + field *telemetry.TelemetryField, + prefix, encodingPath string, + tags map[string]string, + timestamp time.Time, +) { name := strings.ReplaceAll(field.Name, "-", "_") if (name == "modTs" || name == "createTs") && decodeValue(field) == "never" { diff --git a/plugins/inputs/cloudwatch_metric_streams/cloudwatch_metric_streams_test.go b/plugins/inputs/cloudwatch_metric_streams/cloudwatch_metric_streams_test.go index fa10aa9aa3e20..3379c34c128c5 100644 --- a/plugins/inputs/cloudwatch_metric_streams/cloudwatch_metric_streams_test.go +++ b/plugins/inputs/cloudwatch_metric_streams/cloudwatch_metric_streams_test.go @@ -69,7 +69,7 @@ func getHTTPSClient() *http.Client { } } -func createURL(scheme string, path string) string { +func createURL(scheme, path string) string { u := url.URL{ Scheme: scheme, Host: "localhost:8080", diff --git a/plugins/inputs/couchbase/couchbase.go b/plugins/inputs/couchbase/couchbase.go index df349dfbd07ce..e13d732131db8 100644 --- a/plugins/inputs/couchbase/couchbase.go +++ b/plugins/inputs/couchbase/couchbase.go @@ -180,7 +180,7 @@ func (cb *Couchbase) basicBucketStats(basicStats map[string]interface{}) map[str return fields } -func (cb *Couchbase) gatherDetailedBucketStats(server, bucket string, nodeHostname string, fields map[string]interface{}) error { +func (cb *Couchbase) gatherDetailedBucketStats(server, bucket, nodeHostname string, fields map[string]interface{}) error { extendedBucketStats := &BucketStats{} err := cb.queryDetailedBucketStats(server, bucket, nodeHostname, extendedBucketStats) if err != nil { @@ -421,7 +421,7 @@ func (cb *Couchbase) addBucketFieldChecked(fields map[string]interface{}, fieldK cb.addBucketField(fields, fieldKey, values[len(values)-1]) } -func (cb *Couchbase) queryDetailedBucketStats(server, bucket string, nodeHostname string, bucketStats *BucketStats) error { +func (cb *Couchbase) queryDetailedBucketStats(server, bucket, nodeHostname string, bucketStats *BucketStats) error { url := server + "/pools/default/buckets/" + bucket if nodeHostname != "" { url += "/nodes/" + nodeHostname diff --git a/plugins/inputs/cpu/cpu_test.go b/plugins/inputs/cpu/cpu_test.go index d91d74ecd3fcd..225be81c91152 100644 --- a/plugins/inputs/cpu/cpu_test.go +++ b/plugins/inputs/cpu/cpu_test.go @@ -124,8 +124,7 @@ func assertContainsTaggedFloat( t *testing.T, acc *testutil.Accumulator, field string, - expectedValue float64, - delta float64, + expectedValue, delta float64, ) { var actualValue float64 measurement := "cpu" // always cpu diff --git a/plugins/inputs/dcos/client.go b/plugins/inputs/dcos/client.go index 4719cff2aa4ea..4ed2dc5b4e902 100644 --- a/plugins/inputs/dcos/client.go +++ b/plugins/inputs/dcos/client.go @@ -259,7 +259,7 @@ func (c *ClusterClient) GetAppMetrics(ctx context.Context, node, container strin return c.getMetrics(ctx, c.toURL(path)) } -func createGetRequest(address string, token string) (*http.Request, error) { +func createGetRequest(address, token string) (*http.Request, error) { req, err := http.NewRequest("GET", address, nil) if err != nil { return nil, err diff --git a/plugins/inputs/directory_monitor/directory_monitor.go b/plugins/inputs/directory_monitor/directory_monitor.go index 5df2bd44c801d..b0b5a81a3a6d7 100644 --- a/plugins/inputs/directory_monitor/directory_monitor.go +++ b/plugins/inputs/directory_monitor/directory_monitor.go @@ -336,7 +336,7 @@ func (monitor *DirectoryMonitor) sendMetrics(metrics []telegraf.Metric) error { return nil } -func (monitor *DirectoryMonitor) moveFile(srcPath string, dstBaseDir string) { +func (monitor *DirectoryMonitor) moveFile(srcPath, dstBaseDir string) { // Appends any subdirectories in the srcPath to the dstBaseDir and // creates those subdirectories. basePath := strings.Replace(srcPath, monitor.Directory, "", 1) diff --git a/plugins/inputs/dns_query/dns_query.go b/plugins/inputs/dns_query/dns_query.go index a710416bc3cb5..cfef4adfb8d66 100644 --- a/plugins/inputs/dns_query/dns_query.go +++ b/plugins/inputs/dns_query/dns_query.go @@ -107,7 +107,7 @@ func (d *DNSQuery) Gather(acc telegraf.Accumulator) error { return nil } -func (d *DNSQuery) query(domain string, server string) (map[string]interface{}, map[string]string, error) { +func (d *DNSQuery) query(domain, server string) (map[string]interface{}, map[string]string, error) { tags := map[string]string{ "server": server, "domain": domain, diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 189b48528416d..b5e41c9ee9f24 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -608,8 +608,7 @@ func (d *Docker) parseContainerStats( stat *typeContainer.StatsResponse, acc telegraf.Accumulator, tags map[string]string, - id string, - daemonOSType string, + id, daemonOSType string, ) { tm := stat.Read diff --git a/plugins/inputs/docker/stats_helpers.go b/plugins/inputs/docker/stats_helpers.go index a80b98fa948d4..97d8fc06e94fe 100644 --- a/plugins/inputs/docker/stats_helpers.go +++ b/plugins/inputs/docker/stats_helpers.go @@ -66,7 +66,7 @@ func CalculateMemUsageUnixNoCache(mem container.MemoryStats) float64 { return float64(mem.Usage) } -func CalculateMemPercentUnixNoCache(limit float64, usedNoCache float64) float64 { +func CalculateMemPercentUnixNoCache(limit, usedNoCache float64) float64 { // MemoryStats.Limit will never be 0 unless the container is not running and we haven't // got any data from cgroup if limit != 0 { diff --git a/plugins/inputs/dovecot/dovecot.go b/plugins/inputs/dovecot/dovecot.go index 080723b50597c..ac5ec22de46f6 100644 --- a/plugins/inputs/dovecot/dovecot.go +++ b/plugins/inputs/dovecot/dovecot.go @@ -65,7 +65,7 @@ func (d *Dovecot) Gather(acc telegraf.Accumulator) error { return nil } -func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype string, filter string) error { +func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype, filter string) error { var proto string if strings.HasPrefix(addr, "/") { @@ -124,7 +124,7 @@ func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype stri return nil } -func gatherStats(buf *bytes.Buffer, acc telegraf.Accumulator, host string, qtype string) { +func gatherStats(buf *bytes.Buffer, acc telegraf.Accumulator, host, qtype string) { lines := strings.Split(buf.String(), "\n") head := strings.Split(lines[0], "\t") vals := lines[1:] @@ -160,7 +160,7 @@ func gatherStats(buf *bytes.Buffer, acc telegraf.Accumulator, host string, qtype } } -func splitSec(tm string) (sec int64, msec int64) { +func splitSec(tm string) (sec, msec int64) { var err error ss := strings.Split(tm, ".") diff --git a/plugins/inputs/dpdk/dpdk_utils.go b/plugins/inputs/dpdk/dpdk_utils.go index debb311ece1ed..c8115d435a7a5 100644 --- a/plugins/inputs/dpdk/dpdk_utils.go +++ b/plugins/inputs/dpdk/dpdk_utils.go @@ -14,7 +14,7 @@ import ( "github.com/influxdata/telegraf/filter" ) -func commandWithParams(command string, params string) string { +func commandWithParams(command, params string) string { if params != "" { return command + "," + params } diff --git a/plugins/inputs/ecs/ecs.go b/plugins/inputs/ecs/ecs.go index a99f9912221bd..93ead677e74ae 100644 --- a/plugins/inputs/ecs/ecs.go +++ b/plugins/inputs/ecs/ecs.go @@ -193,7 +193,7 @@ func copyTags(in map[string]string) map[string]string { } // returns a new map with the merged content values of the two input maps -func mergeTags(a map[string]string, b map[string]string) map[string]string { +func mergeTags(a, b map[string]string) map[string]string { c := copyTags(a) for k, v := range b { c[k] = v diff --git a/plugins/inputs/elasticsearch_query/aggregation_parser.go b/plugins/inputs/elasticsearch_query/aggregation_parser.go index 352a3a2570b5a..8a507bebd3c80 100644 --- a/plugins/inputs/elasticsearch_query/aggregation_parser.go +++ b/plugins/inputs/elasticsearch_query/aggregation_parser.go @@ -124,7 +124,7 @@ func recurseResponse(acc telegraf.Accumulator, aggNameFunction map[string]string return m, nil } -func getResponseAggregation(function string, aggName string, aggs elastic5.Aggregations) (agg interface{}) { +func getResponseAggregation(function, aggName string, aggs elastic5.Aggregations) (agg interface{}) { switch function { case "avg": agg, _ = aggs.Avg(aggName) diff --git a/plugins/inputs/elasticsearch_query/aggregation_query.go b/plugins/inputs/elasticsearch_query/aggregation_query.go index 1a69750ceb7da..56caa06ea693c 100644 --- a/plugins/inputs/elasticsearch_query/aggregation_query.go +++ b/plugins/inputs/elasticsearch_query/aggregation_query.go @@ -197,7 +197,7 @@ func (aggregation *esAggregation) buildAggregationQuery() error { return nil } -func getFunctionAggregation(function string, aggfield string) (elastic5.Aggregation, error) { +func getFunctionAggregation(function, aggfield string) (elastic5.Aggregation, error) { var agg elastic5.Aggregation switch function { diff --git a/plugins/inputs/exec/exec_test.go b/plugins/inputs/exec/exec_test.go index fa752f26a3490..9ef1f705c88cd 100644 --- a/plugins/inputs/exec/exec_test.go +++ b/plugins/inputs/exec/exec_test.go @@ -73,7 +73,7 @@ type runnerMock struct { err error } -func newRunnerMock(out []byte, errout []byte, err error) Runner { +func newRunnerMock(out, errout []byte, err error) Runner { return &runnerMock{ out: out, errout: errout, diff --git a/plugins/inputs/execd/shim/shim_test.go b/plugins/inputs/execd/shim/shim_test.go index 4e047cc8bccff..33aa87f6ec4ea 100644 --- a/plugins/inputs/execd/shim/shim_test.go +++ b/plugins/inputs/execd/shim/shim_test.go @@ -53,7 +53,7 @@ func TestShimStdinSignalingWorks(t *testing.T) { <-exited } -func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (metricProcessed chan bool, exited chan bool) { +func runInputPlugin(t *testing.T, interval time.Duration, stdin io.Reader, stdout, stderr io.Writer) (metricProcessed, exited chan bool) { metricProcessed = make(chan bool) exited = make(chan bool) inp := &testInput{ diff --git a/plugins/inputs/fibaro/hc2/parser.go b/plugins/inputs/fibaro/hc2/parser.go index c409cd2f3076a..28b002e2db3ea 100644 --- a/plugins/inputs/fibaro/hc2/parser.go +++ b/plugins/inputs/fibaro/hc2/parser.go @@ -7,7 +7,7 @@ import ( "github.com/influxdata/telegraf" ) -func Parse(acc telegraf.Accumulator, sectionBytes []byte, roomBytes []byte, deviecsBytes []byte) error { +func Parse(acc telegraf.Accumulator, sectionBytes, roomBytes, deviecsBytes []byte) error { var tmpSections []Sections if err := json.Unmarshal(sectionBytes, &tmpSections); err != nil { return err diff --git a/plugins/inputs/fibaro/hc3/parser.go b/plugins/inputs/fibaro/hc3/parser.go index 6e1409f77e8fe..d89e7a181cb2e 100644 --- a/plugins/inputs/fibaro/hc3/parser.go +++ b/plugins/inputs/fibaro/hc3/parser.go @@ -9,7 +9,7 @@ import ( "github.com/influxdata/telegraf/internal" ) -func Parse(acc telegraf.Accumulator, sectionBytes []byte, roomBytes []byte, deviecsBytes []byte) error { +func Parse(acc telegraf.Accumulator, sectionBytes, roomBytes, deviecsBytes []byte) error { var tmpSections []Sections if err := json.Unmarshal(sectionBytes, &tmpSections); err != nil { return err diff --git a/plugins/inputs/filecount/filecount_test.go b/plugins/inputs/filecount/filecount_test.go index ffe321751b7a1..1e89d0cbcedf4 100644 --- a/plugins/inputs/filecount/filecount_test.go +++ b/plugins/inputs/filecount/filecount_test.go @@ -239,7 +239,7 @@ func getFakeFileSystem(basePath string) fakeFileSystem { return fakeFileSystem{files: fileList} } -func fileCountEquals(t *testing.T, fc FileCount, expectedCount int, expectedSize int) { +func fileCountEquals(t *testing.T, fc FileCount, expectedCount, expectedSize int) { tags := map[string]string{"directory": getTestdataDir()} acc := testutil.Accumulator{} require.NoError(t, acc.GatherError(fc.Gather)) diff --git a/plugins/inputs/github/github.go b/plugins/inputs/github/github.go index 390102030b479..a054775175d79 100644 --- a/plugins/inputs/github/github.go +++ b/plugins/inputs/github/github.go @@ -158,7 +158,7 @@ func (g *GitHub) handleRateLimit(response *githubLib.Response, err error) { } } -func splitRepositoryName(repositoryName string) (owner string, repository string, err error) { +func splitRepositoryName(repositoryName string) (owner, repository string, err error) { splits := strings.SplitN(repositoryName, "/", 2) if len(splits) != 2 { diff --git a/plugins/inputs/gnmi/gnmi.go b/plugins/inputs/gnmi/gnmi.go index 7b731952252bb..5015bbeb6b1b1 100644 --- a/plugins/inputs/gnmi/gnmi.go +++ b/plugins/inputs/gnmi/gnmi.go @@ -377,7 +377,7 @@ func (c *GNMI) newSubscribeRequest() (*gnmiLib.SubscribeRequest, error) { } // ParsePath from XPath-like string to gNMI path structure -func parsePath(origin string, pathToParse string, target string) (*gnmiLib.Path, error) { +func parsePath(origin, pathToParse, target string) (*gnmiLib.Path, error) { gnmiPath, err := xpath.ToGNMIPath(pathToParse) if err != nil { return nil, err diff --git a/plugins/inputs/google_cloud_storage/google_cloud_storage_test.go b/plugins/inputs/google_cloud_storage/google_cloud_storage_test.go index 367e825eb8a0a..f3d94d8c4d68c 100644 --- a/plugins/inputs/google_cloud_storage/google_cloud_storage_test.go +++ b/plugins/inputs/google_cloud_storage/google_cloud_storage_test.go @@ -333,7 +333,7 @@ func stateFullGCSServer(t *testing.T) *httptest.Server { return srv } -func serveBlobs(t *testing.T, w http.ResponseWriter, urlPath string, offsetKey string) { +func serveBlobs(t *testing.T, w http.ResponseWriter, urlPath, offsetKey string) { singleObjectNotFound := readJSON(t, "testdata/single_object_not_found.json") firstFile := readJSON(t, "testdata/first_file.json") secondFile := readJSON(t, "testdata/second_file.json") diff --git a/plugins/inputs/graylog/graylog.go b/plugins/inputs/graylog/graylog.go index 79ff672c579c1..b2faa08f1899e 100644 --- a/plugins/inputs/graylog/graylog.go +++ b/plugins/inputs/graylog/graylog.go @@ -173,7 +173,7 @@ func (h *GrayLog) gatherServer( // Returns: // // void -func (h *GrayLog) flatten(item map[string]interface{}, fields map[string]interface{}, id string) { +func (h *GrayLog) flatten(item, fields map[string]interface{}, id string) { if id != "" { id = id + "_" }