feat(internal/config): add default_enabled_generator_features to Go configuration#6029
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to define default generator features for Go APIs. Changes include updating the configuration schema, adding a DefaultEnabledGeneratorFeatures field to the Go configuration struct, and implementing the fillGo function to apply these defaults when API-specific features are missing. Feedback suggests removing the unnecessary initialization of lib.Go in the fillGo function, as it only modifies API-level configurations.
suztomo
commented
May 16, 2026
53d2302 to
cfcb10d
Compare
a528a83 to
589e983
Compare
JoeWang1127
reviewed
May 18, 2026
This change introduces default_enabled_generator_features in librarian.yaml's default.go section and updates Librarian to apply these defaults to APIs with empty go configuration. It implements a `union` helper to merge default generator features with API-specific ones while de-duplicating elements and preserving their original insertion order. This custom helper is necessary as the Go standard library does not provide a built-in order-preserving de-duplication helper for slices. Fixes googleapis#5246 TAG=agy CONV=dc5bc0de-b49f-4b0d-ab5c-5e44d6ecd975
589e983 to
d5182d5
Compare
suztomo
commented
May 18, 2026
JoeWang1127
approved these changes
May 18, 2026
JoeWang1127
left a comment
Contributor
There was a problem hiding this comment.
Could you add a test to verify nil GoDefault?
Contributor
|
Could you update the pull request description? |
Member
Author
|
Updated the description:
|
suztomo
added a commit
to googleapis/google-cloud-go
that referenced
this pull request
May 18, 2026
…#14600) This change adds default_enabled_generator_features under `default.go` and removes redundant enabled_generator_features from individual APIs where they match the default. The companion pull request is googleapis/librarian#6029. The librarian change needs to happen first. After that, I'll update the librarian version in `librarian.yaml` in google-cloud-go with a pseudo version. => It is `v0.13.2-0.20260518181009-04b8e642ea4c`. I regenerated the code using the pseudo version: ``` suztomo@suztomo:~/librarian-2026/google-cloud-go$ echo $V v0.13.2-0.20260518181009-04b8e642ea4c suztomo@suztomo:~/librarian-2026/google-cloud-go$ go run github.com/googleapis/librarian/cmd/librarian@${V} generate --all ``` This fixes `maps/mapmanagement/apiv2beta/map_management_client.go` being generated without the `F_open_telemetry_attributes` option (details: googleapis/librarian#5246 (comment)). Fixes googleapis/librarian#5246
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change introduces default_enabled_generator_features in librarian.yaml's default.go section and updates Librarian to append these defaults to APIs'
go.enabled_generator_featureslist.It implements a
unionhelper to merge default generator features with API-specific ones while de-duplicating elements and preserving their original insertion order. This custom helper is necessary as the Go standard library does not provide a built-in order-preserving de-duplication helper for slices. Preserving the order of generator features is important because it ensures the generatedprotoccommand line remains consistent across runs.The companion pull request is googleapis/google-cloud-go#14600. The librarian change needs to happen first. After that, I'll update the librarian version in
librarian.yamlin google-cloud-go with a pseudo version with the default value added there.Fixes #5246