grpc-go/cmd/protoc-gen-go-grpc
Arjan Singh Bal 9c54bbb043
deps: Remove go patch version from go.mod (#7831) (#7877)
* deps: Remove go patch version from go.mod (#7831)

* Remove go minor version from otel
2024-11-26 21:58:30 +05:30
..
README.md cmd/protoc-gen-go-grpc: test the embedded struct at registration time for proper usage (#7438) 2024-07-24 14:52:45 -07:00
go.mod deps: Remove go patch version from go.mod (#7831) (#7877) 2024-11-26 21:58:30 +05:30
go.sum deps: update dependencies for all modules (#7531) 2024-08-19 22:54:01 +05:30
grpc.go Revert "protoc-gen-go-grpc: remove `use_generic_streams_experimental` flag (defaults to true) (#7654) (#7703) 2024-10-07 12:45:19 -07:00
main.go Revert "protoc-gen-go-grpc: remove `use_generic_streams_experimental` flag (defaults to true) (#7654) (#7703) 2024-10-07 12:45:19 -07:00
protoc-gen-go-grpc_test.sh Revert "protoc-gen-go-grpc: remove `use_generic_streams_experimental` flag (defaults to true) (#7654) (#7703) 2024-10-07 12:45:19 -07:00
unimpl_test.go cmd/protoc-gen-go-grpc: remove replace and skip test that requires it for now (#7451) 2024-07-29 09:45:38 -07:00

README.md

protoc-gen-go-grpc

This tool generates Go language bindings of services in protobuf definition files for gRPC. For usage information, please see our quick start guide.

Future-proofing services

By default, to register services using the methods generated by this tool, the service implementations must embed the corresponding Unimplemented<ServiceName>Server for future compatibility. This is a behavior change from the grpc code generator previously included with protoc-gen-go. To restore this behavior, set the option require_unimplemented_servers=false. E.g.:

  protoc --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false[,other options...] \

Note that this is not recommended, and the option is only provided to restore backward compatibility with previously-generated code.

When embedding the Unimplemented<ServiceName>Server in a struct that implements the service, it should be embedded by value instead of as a pointer. If it is embedded as a pointer, it must be assigned to a valid, non-nil pointer or else unimplemented methods would panic when called. This is tested at service registration time, and will lead to a panic in Register<ServiceName>Server if it is not embedded properly.