adhocteam / soapbox

Apache License 2.0
11 stars 3 forks source link

Fixing error after regenerating protobuf code with latest version of protoc #168

Closed orenfromberg closed 6 years ago

orenfromberg commented 6 years ago

@kalilsn ran into a problem while trying to build the soapboxd image after regenerating the protobuf code with make protobufs. This branch updates a couple of dependencies and adds a small code change to regenerate the protobuf code and build the image.

After running make protobufs the *.pb.go files were regenerated successfully. Subsequently running make all causes the following errors to be exposed:

$ make all                                                                                                                                                                   ✔  10064  10:42:48 
go install -ldflags ' -X github.com/adhocteam/soapbox/buildinfo.Version=v0.0.1 -X github.com/adhocteam/soapbox/buildinfo.GitCommit=06fa9d3 -X "github.com/adhocteam/soapbox/buildinfo.BuildTime=Fri Jul 20 10:44:10 EDT 2018"' github.com/adhocteam/soapbox github.com/adhocteam/soapbox/buildinfo github.com/adhocteam/soapbox/cmd/soapboxcli github.com/adhocteam/soapbox/cmd/soapboxd github.com/adhocteam/soapbox/models github.com/adhocteam/soapbox/proto github.com/adhocteam/soapbox/soapboxd
# github.com/adhocteam/soapbox/proto
proto/activity.pb.go:91:44: undefined: proto.InternalMessageInfo
proto/activity.pb.go:135:30: undefined: proto.InternalMessageInfo
proto/activity.pb.go:220:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:229:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:238:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:247:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/application.pb.go:150:33: undefined: proto.InternalMessageInfo
proto/application.pb.go:279:44: undefined: proto.InternalMessageInfo
proto/application.pb.go:317:45: undefined: proto.InternalMessageInfo
proto/application.pb.go:355:43: undefined: proto.InternalMessageInfo
proto/application.pb.go:355:43: too many errors
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2

This problem seemed to be caused by a mismatch between the version of protoc being used and the revision of protobuf in the vendor directory. The Readme says to use the latest version of protoc, which in this case did not match the version in the vendor directory. To fix this I added a constraint to Gopkg.toml and ran dep ensure so that the revision of protobuf in the vendor directory is the same as the revision that the protoc executable originates from.

[[constraint]]
  name = "github.com/golang/protobuf"
  revision = "14aad3d5ea4c323bcd7a2137e735da24a76e814c"

Then running make all gave the following errors:

$ make all                                                                                                                                                               2 ↵  10068  10:51:46 
go install -ldflags ' -X github.com/adhocteam/soapbox/buildinfo.Version=v0.0.1 -X github.com/adhocteam/soapbox/buildinfo.GitCommit=06fa9d3 -X "github.com/adhocteam/soapbox/buildinfo.BuildTime=Fri Jul 20 10:51:50 EDT 2018"' github.com/adhocteam/soapbox github.com/adhocteam/soapbox/buildinfo github.com/adhocteam/soapbox/cmd/soapboxcli github.com/adhocteam/soapbox/cmd/soapboxd github.com/adhocteam/soapbox/models github.com/adhocteam/soapbox/proto github.com/adhocteam/soapbox/soapboxd
# github.com/adhocteam/soapbox/proto
proto/activity.pb.go:220:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:229:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:238:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/activity.pb.go:247:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/application.pb.go:535:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/application.pb.go:544:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/application.pb.go:553:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/application.pb.go:562:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/configuration.pb.go:379:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/configuration.pb.go:388:13: c.cc.Invoke undefined (type *grpc.ClientConn has no field or method Invoke)
proto/configuration.pb.go:388:13: too many errors
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2

This github comment suggested the problem was an older version of grpc, so I updated the grpc constraint accordingly:

[[constraint]]
  name = "google.golang.org/grpc"
-  version = "1.5.0"
+  version = "^1.13.0"

after running dep ensure and make protobufs, the make all error was:

make all                                                                                                                                                               2 ↵  10071  11:03:35 
go install -ldflags ' -X github.com/adhocteam/soapbox/buildinfo.Version=v0.0.1 -X github.com/adhocteam/soapbox/buildinfo.GitCommit=06fa9d3 -X "github.com/adhocteam/soapbox/buildinfo.BuildTime=Fri Jul 20 11:03:36 EDT 2018"' github.com/adhocteam/soapbox github.com/adhocteam/soapbox/buildinfo github.com/adhocteam/soapbox/cmd/soapboxcli github.com/adhocteam/soapbox/cmd/soapboxd github.com/adhocteam/soapbox/models github.com/adhocteam/soapbox/proto github.com/adhocteam/soapbox/soapboxd
# github.com/adhocteam/soapbox/soapboxd
soapboxd/deployment.go:157:55: too few values in struct initializer
Makefile:13: recipe for target 'all' failed
make: *** [all] Error 2

so I changed this line:

-   envReq := pb.GetEnvironmentRequest{req.GetEnv().GetId()}
+   envReq := pb.GetEnvironmentRequest{Id: req.GetEnv().GetId()}

After that, make all completed successfully and the soapboxd image was built.

orenfromberg commented 6 years ago

addresses #167