Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The enforce-repeated-arg-type-style rule finds some false positives. #1032

Closed
zak-pawel opened this issue Sep 5, 2024 · 5 comments · Fixed by #1046 or #1049
Closed

The enforce-repeated-arg-type-style rule finds some false positives. #1032

zak-pawel opened this issue Sep 5, 2024 · 5 comments · Fixed by #1046 or #1049
Assignees

Comments

@zak-pawel
Copy link

Describe the bug
The enforce-repeated-arg-type-style rule finds some false positives. I will demonstrate this using the repository https://github.com/influxdata/telegraf (over 650k lines) as an example.

To Reproduce
Steps to reproduce the behavior:

  1. I updated revive go install github.com/mgechev/revive@latest
  2. I cloned repo and switched to particular branch
git clone https://github.com/influxdata/telegraf.git
cd telegraf
git checkout v1.31.3
  1. I run it with the following flags & configuration file:
# flags
revive -config revive.toml ./... | sort
#revive.toml
[rule.enforce-repeated-arg-type-style]
  arguments = ["short"]
  1. Some of the findings are false positives.

Expected behavior
I would like only the findings that are not false positives to be shown.

Logs
Some examples:

plugins/inputs/webhooks/artifactory/artifactory_webhook.go:23:87: repeated argument type can be omitted:
image

plugins/outputs/bigquery/bigquery.go:244:45: repeated argument type can be omitted:
image

plugins/outputs/mqtt/mqtt_test.go:803:59: repeated argument type can be omitted:
image

Desktop (please complete the following information):

  • OS: Ubuntu 23:10
  • Version of Go:
$ go version 
go version go1.23.0 linux/amd64
@denisvmedia denisvmedia self-assigned this Sep 5, 2024
@denisvmedia
Copy link
Collaborator

Thanks for reporting this. I will check it.

@zak-pawel
Copy link
Author

@denisvmedia
I changed two lines (142 and 174) in rule code and did little debugging:
image

With the same config and the same code as in issue description I got:

../telegraf/plugins/common/parallel/ordered.go:24:2: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/internal/docker/docker.go:7:50: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/fibaro/hc2/parser.go:10:59: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/fibaro/hc2/parser.go:10:77: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/fibaro/hc3/parser.go:12:59: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/fibaro/hc3/parser.go:12:77: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/filter/filter.go:106:2: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/filter/filter.go:113:2: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/filter/filter.go:115:2: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/parsers/json/json_flattener.go:28:2: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/mcrouter/mcrouter.go:140:72: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/templating/template.go:21:39: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/processors/execd/execd.go:81:40: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/github/github.go:161:64: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/opcua_listener/subscribe_client.go:56:70: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/common/starlark/builtins.go:14:36: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/webhooks/github/github_webhooks_test.go:14:55: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/execd/shim/goshim.go:222:74: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/tools/package_incus_test/main.go:96:28: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/couchbase/couchbase.go:183:71: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/stackdriver/stackdriver.go:433:58: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/dns_query/dns_query.go:110:41: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/dovecot/dovecot.go:68:85: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/azure_data_explorer/azure_data_explorer.go:259:67: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/influxdb_listener/influxdb_listener_test.go:98:59: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/jenkins/client.go:116:35: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/hugepages/hugepages.go:159:2: repeated argument type can be omitted, ["map[string]string"] == ["map[string]string"]
../telegraf/plugins/inputs/infiniband/infiniband_linux.go:43:27: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/parsers/avro/schema_registry.go:32:37: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/nfsclient/nfsclient.go:66:50: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/nats_consumer/nats_consumer.go:81:53: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/processors/aws_ec2/ec2.go:79:55: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/cloudwatch/cloudwatch.go:254:44: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/nginx_plus_api/nginx_plus_api_metrics_test.go:1555:49: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/sql/sql_test.go:55:2: repeated argument type can be omitted, ["[]invalid type"] == ["[]invalid type"]
../telegraf/plugins/inputs/filecount/filecount_test.go:241:69: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/outputs/bigquery/bigquery.go:244:45: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/agent/agent.go:677:2: repeated argument type can be omitted, ["chan<- invalid type"] == ["chan<- invalid type"]
../telegraf/plugins/outputs/application_insights/application_insights.go:199:70: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/application_insights/transmitter.go:11:34: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/webhooks/filestack/filestack_webhooks.go:22:84: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/webhooks/papertrail/papertrail_webhooks.go:22:85: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/webhooks/mandrill/mandrill_webhooks.go:23:83: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/stackdriver/counter_cache.go:45:75: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/outputs/stackdriver/stackdriver.go:419:61: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/processors/enum/enum.go:156:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/webhooks/rollbar/rollbar_webhooks.go:23:82: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/syslog/syslog_mapper.go:55:59: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/signalfx/signalfx.go:202:35: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/kubernetes/kubernetes.go:286:97: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/docker/stats_helpers.go:69:52: repeated argument type can be omitted, ["float64"] == ["float64"]
../telegraf/plugins/inputs/snmp/snmp.go:133:54: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/elasticsearch_query/aggregation_parser.go:127:46: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/elasticsearch_query/aggregation_query.go:200:46: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:192:45: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/kafka_consumer/kafka_consumer.go:388:100: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/webhooks/artifactory/artifactory_webhook.go:23:87: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/aggregators/histogram/histogram.go:169:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/openweathermap/openweathermap.go:315:49: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/system/mock_PS.go:49:55: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/system/ps.go:94:2: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/tools/readme_linter/assert.go:104:47: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/mqtt_consumer/mqtt_consumer.go:234:39: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/azure_monitor/azure_monitor.go:159:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/processors/reverse_dns/reverse_dns.go:60:50: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/internal/templating/template.go:86:36: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/common/starlark/builtins.go:51:35: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/webhooks/github/github_webhooks_test.go:27:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/couchbase/couchbase.go:424:70: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/tools/package_incus_test/main.go:96:41: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/common/cookie/cookie.go:36:76: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/azure_data_explorer/azure_data_explorer.go:259:85: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/dovecot/dovecot.go:127:76: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/influxdb_listener/influxdb_listener_test.go:98:72: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/nfsclient/nfsclient.go:66:65: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/bigquery/bigquery.go:253:47: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/stackdriver/counter_cache.go:80:52: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/outputs/stackdriver/stackdriver.go:480:2: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/snmp/snmp.go:133:74: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kafka_consumer/kafka_consumer.go:538:82: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:201:103: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/aggregators/histogram/histogram.go:200:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/webhooks/artifactory/artifactory_webhook.go:73:65: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/system/mock_PS.go:49:82: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/system/ps.go:95:2: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/azure_monitor/azure_monitor.go:160:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/mqtt_consumer/mqtt_consumer.go:267:49: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/common/starlark/builtins.go:71:37: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/dovecot/dovecot.go:163:38: repeated return type can be omitted, ["int64"] == ["int64"]
../telegraf/plugins/aggregators/histogram/histogram.go:237:57: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:219:47: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/azure_monitor/azure_monitor.go:161:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/mqtt_consumer/mqtt_consumer.go:408:33: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:234:68: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:242:108: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/mqtt_consumer/mqtt_consumer.go:427:62: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:242:126: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:262:41: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:299:65: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:307:102: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:307:123: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:329:80: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:329:98: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:329:122: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:344:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:345:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:347:2: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:360:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:360:64: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:360:98: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/aerospike/aerospike.go:375:87: repeated argument type can be omitted, ["map[string]string"] == ["map[string]string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:425:64: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:430:38: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:446:34: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:446:51: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aerospike/aerospike.go:446:69: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/common/shim/processor_test.go:33:56: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/vsphere/endpoint.go:275:41: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/vsphere/endpoint.go:283:33: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/vsphere/endpoint.go:1001:84: repeated argument type can be omitted, ["time.Time"] == ["time.Time"]
../telegraf/plugins/outputs/librato/librato.go:121:41: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/parsers/influx/escape.go:57:40: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/parsers/influx/handler.go:54:44: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/docker_log/docker_log.go:250:2: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/models/filter.go:287:47: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/models/running_output.go:72:2: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/models/running_processor.go:90:52: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/models/buffer.go:35:29: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/statsd/datadog.go:26:67: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/statsd/running_stats.go:152:32: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/processors/starlark/starlark.go:49:52: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/common/shim/input.go:79:74: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/common/shim/goshim_test.go:34:138: repeated return type can be omitted, ["chan bool"] == ["chan bool"]
../telegraf/plugins/common/shim/input_test.go:57:130: repeated return type can be omitted, ["chan bool"] == ["chan bool"]
../telegraf/plugins/inputs/vsphere/vsan.go:71:111: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/vsphere/tscache.go:43:37: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/vsphere/client.go:349:94: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/outputs/librato/librato.go:121:56: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/inputs/vsphere/endpoint.go:1417:84: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/parsers/influx/handler.go:61:44: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/parsers/influx/escape.go:63:41: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/models/filter.go:298:46: repeated argument type can be omitted, ["[]models.TagFilter"] == ["[]models.TagFilter"]
../telegraf/plugins/inputs/vsphere/vsan.go:153:61: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/inputs/vsphere/tscache.go:54:35: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/parsers/influx/handler.go:75:45: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/vsphere/vsan.go:362:85: repeated argument type can be omitted, ["*invalid type"] == ["*invalid type"]
../telegraf/plugins/parsers/influx/handler.go:89:46: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/vsphere/tscache.go:62:35: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/parsers/influx/handler.go:103:47: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/vsphere/vsan.go:424:67: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/parsers/influx/handler.go:110:45: repeated argument type can be omitted, ["[]byte"] == ["[]byte"]
../telegraf/plugins/inputs/vsphere/tscache.go:71:31: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/vsphere/vsan.go:497:50: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/outputs/zabbix/autoregister_test.go:117:2: repeated return type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/sqlserver/connectionstring.go:16:77: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/sqlserver/connectionstring.go:34:82: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/sqlserver/connectionstring.go:74:77: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/dpdk/dpdk_connector.go:141:69: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/dpdk/dpdk_utils.go:17:40: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:57:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/common/opcua/opcua_util.go:34:104: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis_sentinel/redis_sentinel.go:333:2: repeated argument type can be omitted, ["map[string]string"] == ["map[string]string"]
../telegraf/plugins/inputs/kinesis_consumer/kinesis_consumer.go:326:42: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:57:72: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/common/opcua/opcua_util.go:348:116: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:57:89: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/kinesis_consumer/kinesis_consumer.go:326:50: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:57:106: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:110:51: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/kinesis_consumer/kinesis_consumer.go:327:42: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/snmp_trap/snmp_trap_test.go:138:51: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/proxmox/proxmox_test.go:27:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/gnmi/gnmi.go:380:31: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/gnmi/gnmi.go:380:51: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/ecs/ecs.go:196:37: repeated argument type can be omitted, ["map[string]string"] == ["map[string]string"]
../telegraf/plugins/inputs/directory_monitor/directory_monitor.go:339:59: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/intel_rdt/intel_rdt.go:529:39: repeated argument type can be omitted, ["[]int"] == ["[]int"]
../telegraf/plugins/inputs/intel_rdt/publisher.go:37:45: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/sysstat/sysstat.go:201:66: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/sysstat/sysstat.go:285:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/intel_pmu/mocks.go:138:70: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/intel_pmu/mocks.go:138:102: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/intel_pmu/mocks.go:390:62: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/intel_pmu/resolver.go:81:80: repeated return type can be omitted, ["[]*intel_pmu.eventWithQuals"] == ["[]*intel_pmu.eventWithQuals"]
../telegraf/plugins/inputs/intel_pmu/config.go:213:59: repeated return type can be omitted, ["[]int"] == ["[]int"]
../telegraf/plugins/outputs/cratedb/cratedb.go:106:30: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/intel_pmu/intel_pmu.go:329:37: repeated argument type can be omitted, ["uint64"] == ["uint64"]
../telegraf/plugins/inputs/intel_pmu/intel_pmu_test.go:402:29: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/plugins/outputs/cratedb/cratedb.go:216:29: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/intel_pmu/config.go:227:66: repeated return type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/intel_pmu/intel_pmu.go:329:53: repeated argument type can be omitted, ["uint64"] == ["uint64"]
../telegraf/plugins/inputs/mongodb/mongodb_server.go:56:63: repeated argument type can be omitted, ["interface{}"] == ["interface{}"]
../telegraf/plugins/inputs/mongodb/mongodb_server.go:276:2: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/mongodb/mongodb_server.go:277:2: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/mongodb/mongostat.go:931:57: repeated return type can be omitted, ["int64"] == ["int64"]
../telegraf/plugins/inputs/mongodb/mongodb_server.go:278:2: repeated argument type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/graylog/graylog.go:176:56: repeated argument type can be omitted, ["map[string]interface{}"] == ["map[string]interface{}"]
../telegraf/plugins/inputs/bond/bond.go:82:56: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/bond/bond.go:101:51: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/bond/bond.go:213:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis/redis.go:495:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis/redis.go:526:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis/redis.go:573:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis/redis.go:613:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/redis/redis.go:658:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/graylog/graylog.go:158:51: repeated argument type can be omitted, ["int"] == ["int"]
../telegraf/internal/process/process.go:40:28: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/inputs/ping/ping_notwindows.go:108:33: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/ping/ping_notwindows.go:217:46: repeated return type can be omitted, ["int"] == ["int"]
../telegraf/testutil/accumulator.go:290:50: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:300:55: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:312:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/metric.go:227:76: repeated argument type can be omitted, ["[]invalid type"] == ["[]invalid type"]
../telegraf/testutil/metric.go:249:77: repeated argument type can be omitted, ["[]invalid type"] == ["[]invalid type"]
../telegraf/testutil/accumulator.go:490:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:505:55: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/metric.go:294:85: repeated argument type can be omitted, ["[]invalid type"] == ["[]invalid type"]
../telegraf/testutil/metric.go:318:86: repeated argument type can be omitted, ["[]invalid type"] == ["[]invalid type"]
../telegraf/testutil/accumulator.go:523:57: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:541:57: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:559:58: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:577:56: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:595:57: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:626:52: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:644:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:662:55: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:680:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:698:54: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:716:55: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:733:53: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/testutil/accumulator.go:733:76: repeated return type can be omitted, ["bool"] == ["bool"]
../telegraf/plugins/inputs/smartctl/smartctl_device.go:12:76: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/serializers/graphite/graphite.go:191:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/serializers/graphite/graphite.go:285:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/serializers/graphite/graphite.go:286:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/serializers/graphite/graphite.go:287:2: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/serializers/graphite/graphite.go:361:38: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/nsd/nsd.go:41:86: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/exec/exec.go:107:70: repeated argument type can be omitted, ["[]string"] == ["[]string"]
../telegraf/plugins/parsers/nagios/parser.go:281:53: repeated return type can be omitted, ["float64"] == ["float64"]
../telegraf/plugins/processors/snmp_lookup/backlog.go:27:43: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/processors/snmp_lookup/lookup.go:103:41: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/processors/snmp_lookup/store.go:85:38: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/outputs/postgresql/table_manager.go:158:2: repeated argument type can be omitted, ["[]*invalid type"] == ["[]*invalid type"]
../telegraf/plugins/outputs/postgresql/table_manager.go:160:2: repeated argument type can be omitted, ["*postgresql.tableState"] == ["*postgresql.tableState"]
../telegraf/plugins/outputs/postgresql/table_manager.go:357:2: repeated argument type can be omitted, ["*postgresql.tableState"] == ["*postgresql.tableState"]
../telegraf/plugins/outputs/riemann/riemann.go:144:40: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/internal/internal.go:362:31: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/proxmox/proxmox.go:89:49: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/proxmox/proxmox.go:223:40: repeated argument type can be omitted, ["encoding/json.Number"] == ["encoding/json.Number"]
../telegraf/plugins/outputs/mqtt/topic_name_generator.go:19:48: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/sflow/sflow.go:122:32: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:27:70: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:27:85: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:27:101: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:64:18: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:64:33: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:37:18: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:37:33: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:85:18: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:85:33: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:91:53: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:91:68: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:161:18: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:161:33: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_gosmi.go:91:84: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:162:2: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:190:76: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:190:91: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/internal/snmp/translator_netsnmp.go:190:107: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/amqp_consumer/amqp_consumer.go:423:68: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/aliyuncms/aliyuncms.go:345:65: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aliyuncms/aliyuncms.go:477:37: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/aliyuncms/discovery.go:95:2: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/processors/ifname/ifname.go:160:46: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/outputs/azure_monitor/azure_monitor.go:187:57: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/dcos/client.go:262:39: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/config/config.go:945:53: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/config/config.go:1730:40: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/config/secret.go:311:43: repeated return type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/kube_inventory/ingress.go:22:63: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/resourcequotas.go:23:76: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/client.go:26:60: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/kube_inventory/pod.go:52:93: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/pod.go:52:113: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/endpoint.go:22:67: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/persistentvolumeclaim.go:23:94: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/kube_inventory/certificate.go:62:68: repeated argument type can be omitted, ["invalid type"] == ["invalid type"]
../telegraf/plugins/inputs/intel_powerstat/intel_powerstat.go:540:62: repeated return type can be omitted, ["int"] == ["int"]
../telegraf/plugins/inputs/intel_powerstat/intel_powerstat.go:980:99: repeated return type can be omitted, ["float64"] == ["float64"]
../telegraf/plugins/inputs/intel_pmt/xml_parser.go:202:79: repeated argument type can be omitted, ["map[string]bool"] == ["map[string]bool"]
../telegraf/plugins/inputs/intel_pmt/xml_parser.go:249:30: repeated argument type can be omitted, ["uint64"] == ["uint64"]
../telegraf/plugins/inputs/intel_pmt/intel_pmt.go:302:106: repeated argument type can be omitted, ["string"] == ["string"]
../telegraf/plugins/inputs/phpfpm/fcgi.go:155:48: repeated argument type can be omitted, ["uint16"] == ["uint16"]
../telegraf/plugins/inputs/phpfpm/fcgi_client.go:47:83: repeated return type can be omitted, ["[]byte"] == ["[]byte"]

As you can see, there are a lot of invalid types.

May it be related to multiple importers?
image

@denisvmedia
Copy link
Collaborator

denisvmedia commented Sep 21, 2024

I'm not sure there is a better way than just ignore the invalid types. I don't think we can efficiently parse the types from the imported packages. We could have probably manually analyzed the symbols (the package name/alias + the type name), but I'm not sure it's a good idea. It needs to be carefully verified. For now, I submitted a PR that limits the checks to the current package types + any basic type. I'm afraid, it's the best we can do now.

See #1046

@chavacava
Copy link
Collaborator

Hi @zak-pawel, I've made a PR #1049 with a new implementation of the rule that avoids using type information thus more simple and CPU efficient. Could you please check if the proposed implementation works okay for your case?

cc: @denisvmedia

@zak-pawel
Copy link
Author

@chavacava
I've posted a comment in the mentioned PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants