Skip to content

refactor(github): isolate go-github behind compat alias package#255

Closed
jumoog wants to merge 1 commit intocbrgm:mainfrom
intro-skipper:isolate-go-github
Closed

refactor(github): isolate go-github behind compat alias package#255
jumoog wants to merge 1 commit intocbrgm:mainfrom
intro-skipper:isolate-go-github

Conversation

@jumoog
Copy link
Copy Markdown

@jumoog jumoog commented Apr 30, 2026

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.

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.
@jumoog jumoog requested a review from cbrgm as a code owner April 30, 2026 22:20
Copy link
Copy Markdown
Owner

@cbrgm cbrgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cbrgm cbrgm closed this May 1, 2026
@jumoog jumoog deleted the isolate-go-github branch May 1, 2026 10:54
@jumoog
Copy link
Copy Markdown
Author

jumoog commented May 1, 2026

Fair enough! Thank you for the package!

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.

2 participants