Comment 0 for bug 1828230

Revision history for this message
Tiit Pikma (thsnr) wrote :

Disco updated golang-goprotobuf-dev to version 1.2.0-1. The protoc-gen-go binary included with it generates grpc code that requires google.golang.org/grpc version 1.8.0 or newer.

Disco and eoan contain golang-google-grpc-dev version 1.6.0-3. Since the source includes code that is regenerated during building it fails to build from source.

(This also means that any developers using golang-goprotobuf-dev and golang-google-grpc-dev from disco or eoan are unable to build their generated code, but fixing the FTBFS also fixes their problems.)

As a little background explanation, github.com/grpc/grpc-go introduced two new API methods in 1.8.0: ClientConn.Invoke and ClientConn.NewStream, deprecating grpc.Invoke and grpc.NewClientStream, respectively: https://github.com/grpc/grpc-go/commit/a5986a5c88227370a9c0a82e5277167229c034cd

github.com/golang/protobuf dropped use of the deprecated functions in generated grpc code in favor of the new ones in 1.2.0: https://github.com/golang/protobuf/commit/7c4add53b497798e7fd7b204f28e41ab409bdbb7

[Test Case]

golang-google-grpc-dev fails to build from source on disco and eoan. See https://launchpad.net/ubuntu/+source/golang-google-grpc/1.6.0-3ubuntu0.19.04.1/+build/16729837 (although that build included a proposed patch, the same failure occurs without it).

An alternative, minimal test case:
1. sudo apt install golang-google-grpc-dev
2. Copy simple.proto from the bug attachments to an empty directory.
3. protoc simple.proto --go_out=plugins=grpc:.
4. GOPATH=/usr/share/gocode/ go build simple.pb.go

Expected output:
Nothing

Actual output:
# command-line-arguments
./simple.pb.go:86:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
./simple.pb.go:94:21: c.cc.NewStream undefined (type *grpc.ClientConn has no field or method NewStream)

Without updating golang-google-grpc-dev to at least version 1.8.0, I can see two possible workarounds.

The first is to apply a patch to golang-goprotobuf-dev that reverts 7c4add53b497798e7fd7b204f28e41ab409bdbb7.

The second is to patch golang-google-grpc-dev to include ClientConn.Invoke and ClientConn.NewStream wrapper functions that call the old API internally.

Release: Ubuntu 19.04
Release: Ubuntu 19.10 (development branch)
Package: golang-google-grpc 1.6.0-3