fix(gen): source go-github version from go.mod - #278
Merged
Conversation
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make the go-github version a single source of truth read from
go.mod, instead of hardcoding it in the generator templates.gen/gomod.goparsesgo.modand derives the go-github import path (module path +/github)gen/template_*.tmplnow use{{ .GoGithubImport }}instead of a baked-in.../v89/githubWhy
Every go-github major bump broke CI, and this is why: the version lived in three places that had to agree (
go.mod, all 103 generated files, and the templates). Renovate bumps the first two but never the templates. CI runsmake generate-> the still-v89 templates regenerate every file back to v89, clobbering Renovate's edits -> the code references a version that isn't vendored ->git diff --exit-code("format") fails. So Renovate could never make a go-github major bump pass on its own, someone had to hand-edit the templates every time.With the version coming from
go.mod,make generatereproduces exactly what Renovate committed -> clean diff -> green. No more manual template edits, ever.-> This unblocks #277 (and every future go-github bump). Once this is on
main, I'll rebase #277 on top and it goes green with no changes.Testing
make generate && git diff --exit-code githubevents/-> clean (byte-identical at v89, proves the derivation reproduces the committed tree)make generate+make format-> 0 added churn (the format failure is gone)make testgreen,go vet ./...cleanNo behavior change and no public API change, this is a generator-internals + template change only.
Checklist
gen/gomod_test.gocovers found / missing / multiple-version cases)