New Go API for protobuf

203 views
Skip to first unread message

Tharaneedharan Vilwanathan

unread,
Apr 13, 2020, 6:41:43 PM4/13/20
to golang-nuts
Hi,

I have a quick question.

I was going through this:
https://blog.golang.org/protobuf-apiv2

I would like to know if grpc is using this new version. To the extent I tried, it seemed to use the old API. Am I right? If so, how do I make grpc use the new API? Or am I missing something?

Please let me know. Appreciate your help!

Regards
dharani

Ian Lance Taylor

unread,
Apr 13, 2020, 6:50:13 PM4/13/20
to Tharaneedharan Vilwanathan, Joe Tsai, golang-nuts
[ + joetsai ]
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAN-HoC%3D0JFTTzsQ9LwxTnX3k6F9KdRWG2aAu76W6hSkkvjCzvg%40mail.gmail.com.

thebroke...@gmail.com

unread,
Apr 13, 2020, 7:01:23 PM4/13/20
to golang-nuts
As of right now, grpc is on github.com/golang/prot...@v1.3.3. However, nothing stops you in your specific application to upgrade to github.com/golang/prot...@v1.4.0, which just a thin wrapper over the google.golang.org/protobuf module. Better yet, if you were to start using the google.golang.org/protobuf module directly, it would impose a weak dependency on github.com/golang/prot...@v1.4.0, which would cause grpc to be built with the new implementation.

JT

On Monday, April 13, 2020 at 3:50:13 PM UTC-7, Ian Lance Taylor wrote:
[ + joetsai ]

On Mon, Apr 13, 2020 at 3:41 PM Tharaneedharan Vilwanathan
<vdha...@gmail.com> wrote:
>
> Hi,
>
> I have a quick question.
>
> I was going through this:
> https://blog.golang.org/protobuf-apiv2
>
> I would like to know if grpc is using this new version. To the extent I tried, it seemed to use the old API. Am I right? If so, how do I make grpc use the new API? Or am I missing something?
>
> Please let me know. Appreciate your help!
>
> Regards
> dharani
>
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.

thebroke...@gmail.com

unread,
Apr 13, 2020, 7:57:17 PM4/13/20
to golang-nuts
In terms of whether the public API needs to change in light of the new protobuf API, the only place that the old protobuf API leaks to the public grpc API is here: https://pkg.go.dev/google.golang.org/grpc/credentials?tab=doc#OtherChannelzSecurityValue (where it uses the old proto.Message definition here). It seems that users of grpc should be able to use it with almost no effort at all.

JT

On Monday, April 13, 2020 at 4:01:23 PM UTC-7, Joe Tsai wrote:
As of right now, grpc is on github.com/golang/protobuf@v1.3.3. However, nothing stops you in your specific application to upgrade to github.com/golang/protobuf@v1.4.0, which just a thin wrapper over the google.golang.org/protobuf module. Better yet, if you were to start using the google.golang.org/protobuf module directly, it would impose a weak dependency on github.com/golang/protobuf@v1.4.0, which would cause grpc to be built with the new implementation.

Tharaneedharan Vilwanathan

unread,
Apr 17, 2020, 3:41:31 AM4/17/20
to thebroke...@gmail.com, golang-nuts
Thank you all for the response. I changed the version to 1.4.0 for protobuf in grpc. I think it works fine but it also looked like if I attempt to regenerate .pb.go file for the "helloworld" example of grpc, it didn't quite seem to work. I will try it again a bit later.

Regards
dharani 

On Mon, Apr 13, 2020 at 4:56 PM <thebroke...@gmail.com> wrote:
In terms of whether the public API needs to change in light of the new protobuf API, the only place that the old protobuf API leaks to the public grpc API is here: https://pkg.go.dev/google.golang.org/grpc/credentials?tab=doc#OtherChannelzSecurityValue (where it uses the old proto.Message definition here). It seems that users of grpc should be able to use it with almost no effort at all.

JT

On Monday, April 13, 2020 at 4:01:23 PM UTC-7, Joe Tsai wrote:
As of right now, grpc is on github.com/golang/prot...@v1.3.3. However, nothing stops you in your specific application to upgrade to github.com/golang/prot...@v1.4.0, which just a thin wrapper over the google.golang.org/protobuf module. Better yet, if you were to start using the google.golang.org/protobuf module directly, it would impose a weak dependency on github.com/golang/prot...@v1.4.0, which would cause grpc to be built with the new implementation.

JT

On Monday, April 13, 2020 at 3:50:13 PM UTC-7, Ian Lance Taylor wrote:
[ + joetsai ]

On Mon, Apr 13, 2020 at 3:41 PM Tharaneedharan Vilwanathan
<vdha...@gmail.com> wrote:
>
> Hi,
>
> I have a quick question.
>
> I was going through this:
> https://blog.golang.org/protobuf-apiv2
>
> I would like to know if grpc is using this new version. To the extent I tried, it seemed to use the old API. Am I right? If so, how do I make grpc use the new API? Or am I missing something?
>
> Please let me know. Appreciate your help!
>
> Regards
> dharani
>
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAN-HoC%3D0JFTTzsQ9LwxTnX3k6F9KdRWG2aAu76W6hSkkvjCzvg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/49362219-9235-4960-b5b4-9a55049e2e54%40googlegroups.com.

Tharaneedharan Vilwanathan

unread,
Apr 17, 2020, 5:10:35 AM4/17/20
to thebroke...@gmail.com, golang-nuts

Hi,

In GRPC examples, I deleted helloworld.pb.go and recreated it (after installing protoc-gen-go from "google.golang.org/protobuf" cmd):

xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ cd helloworld/
xx:~/gopath/src/google.golang.org/grpc/examples/helloworld/helloworld$ protoc --go_out=. helloworld.proto 

I then tried to build server and client binaries:

xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ go build -o server -v -a greeter_server/main.go
...
command-line-arguments
# command-line-arguments
greeter_server/main.go:39:2: undefined: helloworld.UnimplementedGreeterServer
greeter_server/main.go:54:2: undefined: helloworld.RegisterGreeterServer
xx:~/gopath/src/google.golang.org/grpc/examples/helloworld$ go build -o client -v -a greeter_client/main.go
...
# command-line-arguments
greeter_client/main.go:44:7: undefined: helloworld.NewGreeterClient

Am I the only one seeing this issue? Did I make any mistake?

Regards
dharani

Reply all
Reply to author
Forward
0 new messages