Linting broke windows testing for krypto's TPM code
(This is here, because krypto doesn't have issues)
We recently turn off testing the TPM package on windows. https://github.com/kolide/krypto/blob/1e8bbc1fe3449d94a5e59d4a91b1b6a3aa2c4f96/pkg/tpm/tpm_test.go#L1C1-L2
This is because testing there results in a near incomprehensible error from golangci:
Running [D:\a\_temp\f0e73937-0e7c-479f-b954-874cd7b4e4a1\golangci-lint-1.52.2-windows-amd64\golangci-lint run --out-format=github-actions] in [] ...
level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package internal: could not load export data: no export data for \"github.com/google/go-tpm-tools/simulator/internal\""
level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: buildir: failed to load package internal: could not load export data: no export data for \"github.com/google/go-tpm-tools/simulator/internal\"\n\n"
After a lot of digging and false starts, I kinda understand it. Basically, goanalysis_metalinter isn't a linter. It's a collection of linters based on the the goanalysis framework. These all require things be built, and theres an optimization that causes them all to be grouped together into a goanalysis_metalinter.
And the problem we're bumping into, is some kinda of built error at the pre-build step.
This is why we cannot exclude this file from this linter. This linter doesn't really exist, and it's an error happening at build time, not lint time.
You can get a sense of how this works from the code that aggregates these, and then all the linters that would be impacted.
So the real question, is why is the build broken, using test tags, on windows?
- In some giant github issue, I saw a suggestion that it might be related to
GOROOTorGOBUILDsettings. - https://github.com/google/go-tpm-tools/pull/296 purports to fix it