Comments (5)
Gotcha. Sorry for the misunderstanding -- the GRPC feature is an experimental implementation that is still being tested and which adds support for pooling responses on GRPC Streams (something that can also be done manually, but requires writing some annoying boilerplate). I definitely agree that it should not be enabled by default, particularly since it seems like sometimes it is generating code that conflicts with the default GRPC Go plug-in. I'm going to change the default so it doesn't include GRPC compilation, at least until the feature is more well-baked.
Thanks for the feedback!
from vtprotobuf.
On closer inspection, the issue is slightly different than #19. In this case I have only a single proto file, and the duplicated components appear to be the gRPC types only:
$ go build
# example.com/echo-grpc
.\echo_vtproto.pb.go:33:6: EchoClient redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:24:6: previous declaration
.\echo_vtproto.pb.go:38:6: echoClient redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:29:6: previous declaration
.\echo_vtproto.pb.go:42:6: NewEchoClient redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:33:49: previous declaration
.\echo_vtproto.pb.go:67:6: EchoServer redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:58:6: previous declaration
.\echo_vtproto.pb.go:74:6: UnimplementedEchoServer redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:64:6: previous declaration
.\echo_vtproto.pb.go:88:6: UnsafeEchoServer redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:77:6: previous declaration
.\echo_vtproto.pb.go:92:6: RegisterEchoServer redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:81:54: previous declaration
.\echo_vtproto.pb.go:96:6: _Echo_Echo_Handler redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:85:147: previous declaration
.\echo_vtproto.pb.go:114:6: _Echo_Error_Handler redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:103:148: previous declaration
.\echo_vtproto.pb.go:135:5: Echo_ServiceDesc redeclared in this block
C:\Users\user\Documents\echo-grpc\echo_grpc.pb.go:124:5: previous declaration
.\echo_vtproto.pb.go:135:5: too many errors
In addition, the server types in the echo_vtproto.pb.go
file ignore options such as require_unimplemented_servers=false
passed to the go-grpc plugin (attempting to pass the same option to go-vtproto errors that the option is unknown).
buf.gen.yaml:
version: v1
plugins:
- name: go
out: .
opt:
- paths=source_relative
- name: go-grpc
out: .
opt:
- paths=source_relative
- require_unimplemented_servers=false
- name: go-vtproto
out: .
opt:
- paths=source_relative
from vtprotobuf.
As discovered over in the buf thread, there appears to be a "grpc" feature that's enabled by default but not referenced in the README that causes the duplicate code. So unrelated to buf entirely.
I guess the question now is what is the difference between the go-grpc generator for gRPC stubs or using vtproto to generate the stubs? And how can options like require_unimplemented_servers
be set when using the vtproto grpc stub generation?
from vtprotobuf.
Hey @nvx, could you please ellaborate on what is the feature that is enabled by default that is not shown in the README?
from vtprotobuf.
Hey @nvx, could you please ellaborate on what is the feature that is enabled by default that is not shown in the README?
The grpc feature. The default appears to be equivalent to passing --vtproto_opt=features=size+marshal+unmarshal+pool+grpc
, while the first 4 features in that list are documented in the readme, the grpc feature is not (and conflicts with the go-grpc plugin). The implementation of the grpc feature appears to be here https://github.com/planetscale/vtprotobuf/tree/main/features/grpc
I'm basically looking to understand the differences between vtproto grpc feature vs go-grpc, especially since go-grpc is what the example in the readme uses so it's not really clear which is "best" and what the tradeoffs between the two approaches might be.
from vtprotobuf.
Related Issues (20)
- Uncompilable code generated for repeated groups
- Duplicated code generated for GRPC client/server HOT 1
- Panic after WKT commit: assignment to entry in nil map HOT 2
- Extensions are not encoded
- docs/feature: Nested ReturnToVTPool() HOT 4
- bug: oneof field that includes bytes field yields invalid ResetVT method
- Supporting Embedded and Nullable features from gogo proto HOT 2
- bug: Broken ResetVT generation for optional message HOT 1
- bug: grpc client methods does not use qualified idents
- feature: poolable messages paths with wildcard HOT 2
- unmarshal_unsafe feature produced code does not compile: "Cannot use intStringLen (type int) as the type IntegerType" HOT 1
- Run vtproto multiple times on different files of the same package HOT 3
- bug: IsMap not checked on message field's ReturnToVTpool
- bug: UnmarshalUnsafe panics when map values are empty strings HOT 2
- Request for New Release that Includes Well-Known Type Support HOT 4
- gRPC codec has different semantic on Unmarshal than the default one HOT 1
- v0.6.0 is creating issues in ubuntu20 HOT 2
- Offering assistance and discussing upkeep / releases for vtprotobuf HOT 8
- wrong pool unmarshal slize HOT 3
- Add optional unsafe operations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vtprotobuf.