Skip to content

feat: add optional const API for Go loader via goconst - #169

Open
Kybxd wants to merge 1 commit into
masterfrom
feat/go-loader-const-option
Open

feat: add optional const API for Go loader via goconst#169
Kybxd wants to merge 1 commit into
masterfrom
feat/go-loader-const-option

Conversation

@Kybxd

@Kybxd Kybxd commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a const=true option to protoc-gen-go-tableau-loader that exposes goconst read-only Foo_Const views through Data() / Get* / Find*, so accidental mutation is a compile error.
  • Default generation stays unchanged (Data() still returns *Foo). Message() remains the mutable escape hatch; MutableCheck still applies to it.
  • Enabling the option also requires running protoc-gen-go-const on the same protos.

Test plan

  • python3 make.py test --lang go (default non-const generation)
  • Enable const=true plus protoc-gen-go-const in a local buf.gen.yaml and confirm Data() / Get* / Find* return Foo_Const and mutation does not compile

Generate read-only Foo_Const views on Data()/Get*/Find* when const=true
so mutation is a compile error, while leaving the default API unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
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