Skip to content

fix(gen): source go-github version from go.mod - #278

Merged
cbrgm merged 3 commits into
mainfrom
phase-1-gomod-version
Aug 12, 2026
Merged

fix(gen): source go-github version from go.mod#278
cbrgm merged 3 commits into
mainfrom
phase-1-gomod-version

Conversation

@cbrgm

@cbrgm cbrgm commented Aug 12, 2026

Copy link
Copy Markdown
Owner

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.go parses go.mod and derives the go-github import path (module path + /github)
  • the three gen/template_*.tmpl now use {{ .GoGithubImport }} instead of a baked-in .../v89/github

Why

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 runs make 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 generate reproduces 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)
  • replayed chore(deps): update module github.com/google/go-github/v89 to v90 #277's actual committed v90 tree, then make generate + make format -> 0 added churn (the format failure is gone)
  • make test green, go vet ./... clean

No behavior change and no public API change, this is a generator-internals + template change only.

Checklist

  • Tests added/updated (gen/gomod_test.go covers found / missing / multiple-version cases)
  • No breaking changes (generated output byte-identical, public API untouched)
  • Readable commit history (3 focused commits)
  • AI code review considered and comments resolved

@cbrgm cbrgm mentioned this pull request Aug 12, 2026
4 tasks
@cbrgm
cbrgm merged commit f490009 into main Aug 12, 2026
5 checks passed
@cbrgm
cbrgm deleted the phase-1-gomod-version branch August 12, 2026 12:45
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