Skip to content

test(generator): vet every generated package, not just the corpus - #122

Merged
giraffesyo merged 1 commit into
canaryfrom
vet-everywhere
Aug 21, 2026
Merged

test(generator): vet every generated package, not just the corpus#122
giraffesyo merged 1 commit into
canaryfrom
vet-everywhere

Conversation

@giraffesyo

Copy link
Copy Markdown
Member

#120 was a package that compiled and silently lost data: two fields sharing a JSON tag, which encoding/json resolves by ignoring both. go vet names it, and #119 had added vet to exactly one test, so the 45 other e2e tests would have watched the same class of bug go past.

Both helpers now vet what they generate:

  • buildGenerated, used by the tests that compile a package
  • runGeneratedWireTest, used by the tests that compile one and run a wire test against it

All 62 e2e tests pass unchanged, so this adds no fixes. It adds the guard that would have caught the last one.

I checked the guard actually fires rather than assuming it: with the allOf deduplication from #121 disabled, the corpus test fails with

types.go:236:2: struct field Name2 repeats json tag "name" also at types.go:234

The corpus test also drops the private buildAndVet it introduced and uses the shared helper.

gofmt, golangci-lint, go vet ./..., and go test ./... pass.

#120 compiled and lost data: two fields sharing a JSON tag, which
encoding/json resolves by ignoring both. go vet names that, and the corpus
test was the only place running it, so 45 other tests would have watched the
same bug go by.

Both e2e helpers now vet what they generate: the one that compiles a package
and the one that compiles and runs a wire test against it. All 62 tests pass
as they stand, so this adds no fixes, only the guard that would have caught
the last one.

The corpus test drops its own copy of the helper and uses the shared one.
@giraffesyo
giraffesyo merged commit 9bd5704 into canary Aug 21, 2026
7 checks passed
@giraffesyo
giraffesyo deleted the vet-everywhere branch August 21, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant