[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Go protobuf v2



Hi,

The Go team is working on a new protobuf package.
https://blog.golang.org/protobuf-apiv2

In short, there are two Go libraries and protoc compiler plugins.
1. protoc-gen-go

The old one is github.com/golang/protobuf/protoc-gen-go.
The new one is google.golang.org/protobuf/cmd/protoc-gen-go.

They share the same binary name. As the protoc compiler searches
plugins by its name, so we shouldn't change them.

The old one supports generating grpc, the new one won't. (The new grpc
plugin will be google.golang.org/grpc/cmd/protoc-gen-go-grpc, in
grpc-go repo).

If golang/protobuf 1.4+ is used, the resulting pb.go files are the
same most of the time. And the pb.go imports both
google.golang.org/protobuf and github.com/golang/protobuf.

2. runtime library

github.com/golang/protobuf v1.4+ (sid has v1.3.4) is built on top of
google.golang.org/protobuf.


Current situation:

google.golang.org/protobuf is in sid now.
https://tracker.debian.org/pkg/golang-google-protobuf
With protoc plugin package name: protoc-gen-go, library name
golang-google-protobuf-dev.

protoc-gen-go conflicts golang-goprotobuf-dev (both have
/usr/bin/protoc-gen-go).


If bump github.com/golang/protobuf to v1.4:

There's no problem if we only care about the old protoc plugin. As
golang-goprotobuf-dev can co-install with golang-google-protobuf-dev.

+ src:golang-goprotobuf B-D golang-google-protobuf-dev
+ golang-goprotobuf-dev Depends golang-google-protobuf-dev

Packages use them:
B-D golang-goprotobuf-dev (and implicit golang-google-protobuf-dev)

It looks good.

But for the new protoc plugin:
Packages use it:
B-D protoc-gen-go, golang-google-protobuf-dev, golang-goprotobuf-dev
(since the pb.go import both)
So it can't be satisfied, as protoc-gen-go conflicts golang-goprotobuf-dev.


To move forward:
I think we can split src:golang-goprotobuf to:
protoc-gen-go-legacy(has /usr/bin/protoc-gen-go) and
golang-github-google-protobuf-dev.

So packages use protoc plugin can:
B-D protoc-gen-go, golang-google-protobuf-dev,
golang-github-google-protobuf-dev.

Any suggestions?

-- 
Shengjing Zhu


Reply to: