googleapis / googleapis/librarian
golang: Support custom plugin generation and internal output routing
- Dominant language
- Go
- Stars
- 45
- Forks
- 61
- Avg merge
- 19h 11m
- Merged PRs (30d)
- 181
Description
### Description / Context
To support advanced performance optimizations (such as memory allocation tuning or custom codecs) in generated client libraries, we need the ability to invoke custom protoc plugins during generation and route their output to private, internal directories.
Currently, generation assumes standard public API layouts. For experimental or advanced optimizations, we need to ensure that the generated optimization code does not leak into the public API surface or pollute the protobuf global registry for end users.
### Requirements
We propose augmenting the Librarian toolchain to support the following capabilities:
1. **Custom Plugin Execution:** The ability to configure and invoke additional protoc plugins (such as protoc-gen-go-vtproto or similar optimization generators) as part of the standard generation pipeline.
2. **Internal Output Routing:** The ability to route the output of specific plugins to a designated internal package directory (e.g., internal/) rather than the public generation surface. In Go, placing these outputs in an internal/ directory ensures they are not surfaced as end-user accessible code.
### Benefits
**Encapsulation:** Allows library maintainers to add performance-critical hotpaths or alternative codecs without exposing experimental or unstable APIs to users.
**Safety:** Keeps public API surfaces clean and isolated from internal optimization details.
**Extensibility:** Makes the generation pipeline more flexible for libraries with extreme performance constraints.
Internal References: go/cloud-sdk-go:spanner-performance-escalation-notes, go/goproto-spanner-client-10x
Contributor guide
Research direction
Start by tracing Librarian's generation pipeline and its plugin configuration and output-routing entry points. Review how standard protoc plugins are invoked and where generated packages are selected. Done means custom plugins can be configured and their output routed to designated internal directories without changing the public generation surface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100