Skip to content

Add support for Go features (features.(pb.go).*) in buf#4363

Open
NexZhu wants to merge 1 commit into
bufbuild:mainfrom
daotl:feat/go-features
Open

Add support for Go features (features.(pb.go).*) in buf#4363
NexZhu wants to merge 1 commit into
bufbuild:mainfrom
daotl:feat/go-features

Conversation

@NexZhu
Copy link
Copy Markdown

@NexZhu NexZhu commented Mar 2, 2026

This commit adds support for configuring Go features in buf.yaml for managed mode code generation and breaking change detection.

Changes:

  • Add ResolveGoFeature and ResolveGoFeatureForEnum functions in customfeatures
  • Add FIELD_SAME_GO_STRIP_ENUM_PREFIX breaking change rule
  • Add FileOptionGoApiLevel for managed mode (features.(pb.go).api_level)
  • Add test for ResolveGoFeature

The Go features use the external google.golang.org/protobuf/types/gofeaturespb package to avoid namespace conflicts.

Note: The strip_enum_prefix breaking rule test is skipped as it requires edition 2024 which is not yet fully supported in buf.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 2, 2026

CLA assistant check
All committers have signed the CLA.

@NexZhu NexZhu force-pushed the feat/go-features branch from afcda35 to 450060f Compare March 2, 2026 07:23
This commit adds support for configuring Go features in buf.yaml for
managed mode code generation and breaking change detection.

Changes:
- Add ResolveGoFeature and ResolveGoFeatureForEnum functions in customfeatures
- Add FIELD_SAME_GO_STRIP_ENUM_PREFIX breaking change rule
- Add FileOptionGoApiLevel for managed mode (features.(pb.go).api_level)
- Add test for ResolveGoFeature

The Go features use the external google.golang.org/protobuf/types/gofeaturespb
package to avoid namespace conflicts.

Note: The strip_enum_prefix breaking rule test is skipped as it requires
edition 2024 which is not yet fully supported in buf.
@NexZhu NexZhu force-pushed the feat/go-features branch from 450060f to e871516 Compare March 2, 2026 07:25
@doriable
Copy link
Copy Markdown
Member

doriable commented Mar 2, 2026

Thank you for submitting this change -- I think this request seems very reasonable. Internally, our current priority is getting Editions 2024 support up and running with our new compiler, and would prefer to review this when it can be completed with the required tests. So transparently, I won't be able to review this until that body of work is complete, but if it is okay with you, I am happy to keep this PR open and will provide feedback once we are ready to accept this request.

@NexZhu
Copy link
Copy Markdown
Author

NexZhu commented Mar 3, 2026

Thank you for submitting this change -- I think this request seems very reasonable. Internally, our current priority is getting Editions 2024 support up and running with our new compiler, and would prefer to review this when it can be completed with the required tests. So transparently, I won't be able to review this until that body of work is complete, but if it is okay with you, I am happy to keep this PR open and will provide feedback once we are ready to accept this request.

Sure

Copy link
Copy Markdown

@themavik themavik left a comment

Choose a reason for hiding this comment

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

ResolveGoFeatureForEnum plus handleBreakingFieldSameGoStripEnumPrefix wires (pb.go).strip_enum_prefix into FIELD_SAME_GO_STRIP_ENUM_PREFIX in the same pattern as the other feature rules.

TestRunBreakingFieldSameGoStripEnumPrefix stays skipped until edition 2024 lands; maybe link the enabling issue in the skip comment so it does not rot.

@AdrianDuan
Copy link
Copy Markdown

@doriable Any updates about this PR? It seems that buf supports edition 2024 now. I'm looking forward to use this new feature in managed mode

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.

5 participants