Skip to content

Windows arm64 and 386 sources are never linted by CI #19773

Description

@skartikey

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

  1. GOOS=windows GOARCH=amd64 golangci-lint run ./plugins/inputs/win_perf_counters/... (this is what CI runs)
  2. GOOS=windows GOARCH=arm64 golangci-lint run ./plugins/inputs/win_perf_counters/...
  3. 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:

  1. 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.
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/windowsRelated to windows plugins (win_eventlog, win_perf_counters, win_services)bugunexpected problem or unintended behaviorplatform/windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions