Skip to content

feat(go): add opt-in Hub/MessagerContainer.Get[T] for Go 1.27 - #171

Open
Kybxd wants to merge 1 commit into
masterfrom
feat/hub-generic-get
Open

Kybxd wants to merge 1 commit into
masterfrom
feat/hub-generic-get

Conversation

@Kybxd

@Kybxd Kybxd commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add plugin opt go127=true to emit generic Hub.Get[T] / MessagerContainer.Get[T], and deprecate package-level GetMessager[T] when enabled.
  • Keep default codegen (no go127) compatible with Go 1.24; typed GetXxxConf() accessors unchanged.
  • Add manual smoke module under _lab/go127 (buf inputs from test/proto, not wired into make.py/CI).

Test plan

  • python3 make.py test --lang go --no-race
  • cd _lab/go127 && buf generate && go test ./... (Go 1.27+)
  • Confirm default generated Hub has no Get[T] without go127=true

Closes #5

Gate generic Get methods behind plugin opt go127=true, deprecate
package-level GetMessager when enabled, and add a manual _lab/go127
smoke module that regenerates from test/proto via buf inputs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kybxd
Kybxd requested a review from wenchy October 10, 2026 09:20
return h.mc.Load().GetMessager(name)
}

{{ if .Go127 }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wait for go 1.29 release

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