Giter Site home page Giter Site logo

buf.build support? about vtprotobuf HOT 5 CLOSED

planetscale avatar planetscale commented on July 19, 2024
buf.build support?

from vtprotobuf.

Comments (5)

vmg avatar vmg commented on July 19, 2024 1

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.

nvx avatar nvx commented on July 19, 2024

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.

nvx avatar nvx commented on July 19, 2024

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.

vmg avatar vmg commented on July 19, 2024

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.

nvx avatar nvx commented on July 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.