-
Notifications
You must be signed in to change notification settings - Fork 34
Generate go apis #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate go apis #106
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Makefile target to streamline generating Go structs from protobuf API definitions so that Go-based control plane components can consume API types without manual protoc invocation.
- Adds generated Go code for API definitions in go/api/a2a
- Updates proto files with go_package options for proper import paths
- Modifies a string literal in the xDS client and introduces the generate-apis target in the Makefile
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
go/api/a2a/a2a/target.pb.go | Generated Go API code from protobuf definitions |
go.mod | Module definition added with Go version specification |
crates/agentgateway/src/xds/client.rs | Updated role string format in API client configuration |
crates/agentgateway/proto/*.proto | Added go_package options to ensure consistent Go code generation |
Makefile | New generate-apis target to automate protobuf code generation |
Comments suppressed due to low confidence (1)
crates/agentgateway/src/xds/client.rs:294
- [nitpick] The updated role string differs from the previous naming convention. Please verify that this change is intentional and consistent with naming used across the system.
"agentgateway-api~{ns}~{name}",
protoc --proto_path=./crates/agentgateway/proto/ \ | ||
--go_out=./go/api/a2a \ | ||
--go_opt=paths=source_relative \ | ||
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \ | ||
./crates/agentgateway/proto/a2a/target.proto | ||
protoc --proto_path=./crates/agentgateway/proto/ \ | ||
--go_out=./go/api/mcp \ | ||
--go_opt=paths=source_relative \ | ||
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \ | ||
./crates/agentgateway/proto/mcp/target.proto | ||
protoc --proto_path=./crates/agentgateway/proto/ \ | ||
--go_out=./go/api \ | ||
--go_opt=paths=source_relative \ | ||
./crates/agentgateway/proto/listener.proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider refactoring the repeated protoc arguments into variables or a helper script to reduce duplication and simplify future updates.
protoc --proto_path=./crates/agentgateway/proto/ \ | |
--go_out=./go/api/a2a \ | |
--go_opt=paths=source_relative \ | |
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \ | |
./crates/agentgateway/proto/a2a/target.proto | |
protoc --proto_path=./crates/agentgateway/proto/ \ | |
--go_out=./go/api/mcp \ | |
--go_opt=paths=source_relative \ | |
--go_opt=Mcommon.proto=github.com/agentgateway/go/api/common \ | |
./crates/agentgateway/proto/mcp/target.proto | |
protoc --proto_path=./crates/agentgateway/proto/ \ | |
--go_out=./go/api \ | |
--go_opt=paths=source_relative \ | |
./crates/agentgateway/proto/listener.proto | |
PROTO_PATH=./crates/agentgateway/proto/ | |
8000 td> | GO_OUT_BASE=./go/api |
GO_OPTS=--go_opt=paths=source_relative --go_opt=Mcommon.proto=github.com/agentgateway/go/api/common | |
protoc --proto_path=$(PROTO_PATH) \ | |
--go_out=$(GO_OUT_BASE)/a2a \ | |
$(GO_OPTS) \ | |
$(PROTO_PATH)/a2a/target.proto | |
protoc --proto_path=$(PROTO_PATH) \ | |
--go_out=$(GO_OUT_BASE)/mcp \ | |
$(GO_OPTS) \ | |
$(PROTO_PATH)/mcp/target.proto | |
protoc --proto_path=$(PROTO_PATH) \ | |
--go_out=$(GO_OUT_BASE) \ | |
--go_opt=paths=source_relative \ | |
$(PROTO_PATH)/listener.proto |
Copilot uses AI. Check for mistakes.
d4673b2
to
e66d376
Compare
Add a generate-go Makefile target to simplify generating Go structs from protobuf API definitions. This target helps Go-based control plane components consume API types without needing manual protoc invocation in the control plane repo.