refactor(github): isolate go-github behind compat alias package#255
refactor(github): isolate go-github behind compat alias package#255jumoog wants to merge 1 commit intocbrgm:mainfrom
Conversation
Add a githubcompat package that re-exports the go-github webhook helpers and event payload types via aliases, then update generated handlers and templates to import that package instead of the versioned go-github path directly. This keeps existing callbacks using github.com/google/go-github/v85/github type-compatible while making future go-github version bumps localized to the compat package.
cbrgm
left a comment
There was a problem hiding this comment.
I'm going to pass on this one. The problem it solves isn't painful enough to justify a new package.
Bumping go-github currently means changing the import in 3 template files and running make generate. Renovate handles this. The compat package doesn't eliminate that work, it just moves it. You'd still update the alias file whenever go-github adds event types.
Some specific issues:
-> Every new event in gen/template_params.go now needs a matching alias in githubcompat/github.go. That manual sync will get missed eventually.
-> Re-exporting ValidatePayload, ParseWebHook etc. as var declarations changes semantics. They become reassignable function values instead of package-level functions. Stack traces get worse, inlining breaks, and someone could accidentally overwrite them.
-> "github.com/google/go-github/v85/github" is immediately clear to anyone reading the code. The compat import adds indirection without actually decoupling anything. Consumers still transitively depend on whatever version is in go.mod.
The coupling is the same, it's just less visible now.
I appreciate the intent, but this is adding machinery for a problem that code generation + renovate already solves.
|
Fair enough! Thank you for the package! |
Add a githubcompat package that re-exports the go-github webhook helpers and event payload types via aliases, then update generated handlers and templates to import that package instead of the versioned go-github path directly.
This keeps existing callbacks using
github.com/google/go-github/v85/github type-compatiblewhile making future go-github version bumps localized to the compat package.