Relevant telegraf.conf
# Not applicable. This is a CI coverage gap in the repository, not a runtime issue.
Logs from Telegraf
Not applicable. Output below is from golangci-lint, not from Telegraf.
System info
Telegraf master (469fcf8), golangci-lint v2.13.1, Go 1.27.0
Docker
Not applicable.
Steps to reproduce
GOOS=windows GOARCH=amd64 golangci-lint run ./plugins/inputs/win_perf_counters/... (this is what CI runs)
GOOS=windows GOARCH=arm64 golangci-lint run ./plugins/inputs/win_perf_counters/...
GOOS=windows GOARCH=386 golangci-lint run ./plugins/inputs/win_perf_counters/...
Expected behavior
All three files compile into shipped Windows binaries, so all three should be linted by CI.
plugins/inputs/win_perf_counters/ has three architecture variants of the same file: pdh_386.go, pdh_amd64.go and pdh_arm64.go. Each carries only //go:build windows, so the architecture constraint comes from the filename suffix rather than the build tag. We publish telegraf-<version>_windows_arm64.zip and telegraf-<version>_windows_i386.zip alongside amd64, so all three files ship.
Actual behavior
Only the amd64 variant is ever linted, and the other two have real findings that nothing catches.
The lint-windows job in .circleci/config.yml runs GOOS=windows golangci-lint run on the telegraf-ci executor, which is amd64. GOARCH is therefore inherited as amd64, so pdh_arm64.go and pdh_386.go are excluded from the build and never analysed.
| Command |
Result |
GOOS=windows GOARCH=amd64 (what CI runs) |
0 issues |
GOOS=windows GOARCH=arm64 |
27 issues (revive comment-spacings) |
GOOS=windows GOARCH=386 |
30 issues (revive 28, unused 1, nolintlint 1) |
The 386 findings include a genuine latent defect rather than only formatting. The //nolint:unused directive is on the wrong line, so it suppresses nothing and the type it was meant to cover is flagged:
plugins/inputs/win_perf_counters/pdh_386.go:43:6 unused type pdhFmtCountervalueLong is unused
plugins/inputs/win_perf_counters/pdh_386.go:46:20 nolintlint directive `//nolint:unused // Memory reservation` is unused for linter "unused"
Additional info
These are currently the only architecture-suffixed .go files in the repository, so the blast radius is this one plugin today. It will grow silently if anyone adds another *_arm64.go or *_386.go.
Two ways to close it, whichever fits the CI budget better:
- Add
GOARCH=arm64 and GOARCH=386 variants to the existing lint-windows job. Cross-compilation linting needs no matching runner, so this stays on the same executor.
- Keep one job and set
GOARCH per step, since only this one package differs between the variants.
Either way the existing findings need clearing first, including moving that //nolint:unused directive onto line 43.
Found while reviewing #19750, but unrelated to it.
Relevant telegraf.conf
# Not applicable. This is a CI coverage gap in the repository, not a runtime issue.Logs from Telegraf
System info
Telegraf master (469fcf8), golangci-lint v2.13.1, Go 1.27.0
Docker
Not applicable.
Steps to reproduce
GOOS=windows GOARCH=amd64 golangci-lint run ./plugins/inputs/win_perf_counters/...(this is what CI runs)GOOS=windows GOARCH=arm64 golangci-lint run ./plugins/inputs/win_perf_counters/...GOOS=windows GOARCH=386 golangci-lint run ./plugins/inputs/win_perf_counters/...Expected behavior
All three files compile into shipped Windows binaries, so all three should be linted by CI.
plugins/inputs/win_perf_counters/has three architecture variants of the same file:pdh_386.go,pdh_amd64.goandpdh_arm64.go. Each carries only//go:build windows, so the architecture constraint comes from the filename suffix rather than the build tag. We publishtelegraf-<version>_windows_arm64.zipandtelegraf-<version>_windows_i386.zipalongside amd64, so all three files ship.Actual behavior
Only the amd64 variant is ever linted, and the other two have real findings that nothing catches.
The
lint-windowsjob in.circleci/config.ymlrunsGOOS=windows golangci-lint runon thetelegraf-ciexecutor, which is amd64.GOARCHis therefore inherited asamd64, sopdh_arm64.goandpdh_386.goare excluded from the build and never analysed.GOOS=windows GOARCH=amd64(what CI runs)GOOS=windows GOARCH=arm64comment-spacings)GOOS=windows GOARCH=386unused1,nolintlint1)The 386 findings include a genuine latent defect rather than only formatting. The
//nolint:unuseddirective is on the wrong line, so it suppresses nothing and the type it was meant to cover is flagged:Additional info
These are currently the only architecture-suffixed
.gofiles in the repository, so the blast radius is this one plugin today. It will grow silently if anyone adds another*_arm64.goor*_386.go.Two ways to close it, whichever fits the CI budget better:
GOARCH=arm64andGOARCH=386variants to the existinglint-windowsjob. Cross-compilation linting needs no matching runner, so this stays on the same executor.GOARCHper step, since only this one package differs between the variants.Either way the existing findings need clearing first, including moving that
//nolint:unuseddirective onto line 43.Found while reviewing #19750, but unrelated to it.