Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Switch to new proto v2 #1691

Merged
merged 8 commits into from
Aug 14, 2020
Merged

Conversation

ondrej-fabry
Copy link
Member

@ondrej-fabry ondrej-fabry commented Jul 31, 2020

This PR updates Protobuf-Go to v2

Protobuf-Go

v2 is actually >=v1.20.0

  • The Protobuf-Go repo actually did not increase the major version number! ⚠️
    The project authors decided to not increase major number, because of the import path changing completely
    (which is actually the important part for Go modules when doing breaking changes to an API)
  • The new Protobuf-Go v2 has much better API that is easier to work with, providing true Protobuf reflection descriptors (instead of Go type reflection)
  • The new interface for proto.Message has just a single method that returns the message reflect
  • Generated messages no longer export fields/funcs intended for internal use 🎊 (e.g. XXX_*)
    • This makes Go docs for generated packages very clean

v1 is actually <=v1.4.0

The module github.com/golang/protobuf has switched its implementation in v1.4.0 to use the new v2 API under the hood while still providing the legacy v1 API and the v2 API allows backwards compatibility by providing conversions from v1

  • github.com/golang/protobuf v1.4.0 go.mod depends on the new google.golang.org/protobuf v1.21.0
  • google.golang.org/protobuf v1.20.0 go.mod depends on the old github.com/golang/protobuf v1.4.0-rc.2

gRPC

  • The gRPC generator is no longer part (plugin) of protoc-gen-go and has been moved to grpc-go repo and now it is a separate generator protoc-gen-go-grpc(executed from the protoc)
  • gRPC related code is now generated in a separate files - *_grpc.pb.go
  • Implementators of gRPC server now must embed a generated dummy implementation of gRPC server Unimplemented*
    (this is most likely to avoid panics on when embedding nil interface)

Links for more info

@ligato ligato deleted a comment from codecov bot Jul 31, 2020
@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #1691 into master will increase coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1691   +/-   ##
=======================================
  Coverage   58.00%   58.00%           
=======================================
  Files         370      370           
  Lines       30095    30093    -2     
=======================================
  Hits        17456    17456           
+ Misses      11197    11193    -4     
- Partials     1442     1444    +2     
Flag Coverage Δ
#unittests 58.00% <33.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ondrej-fabry ondrej-fabry self-assigned this Aug 5, 2020
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>

# Conflicts:
#	proto/ligato/vpp/ipsec/ipsec.pb.go
#	proto/ligato/vpp/vpp.pb.go
@ondrej-fabry ondrej-fabry merged commit 1b4ee27 into ligato:master Aug 14, 2020
@ondrej-fabry ondrej-fabry deleted the new-protobuf2 branch August 14, 2020 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants