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

Implicit inconsistent import of status.proto for go and gRPC #1530

Closed
JimLarson opened this issue Jun 6, 2018 · 5 comments
Closed

Implicit inconsistent import of status.proto for go and gRPC #1530

JimLarson opened this issue Jun 6, 2018 · 5 comments

Comments

@JimLarson
Copy link

When I attempt to use a proto used by the gRPC implementation in my gRPC service, I get a link error from inconsistent versions of the compiled golang library. In this case, I'm attempting to use the Status message from github.com/googleapis/googleapis/google/rpc/status.proto in my application-level protocol.

Please see the following for the code: https://github.com/JimLarson/repro1/tree/70ef7482daf017a356156e495e1eb150f3f1f81b

Running "bazel build ..." results in:

ERROR: /.../repro1/BUILD.bazel:35:1: GoCompile .../repro1/bar.a failed (Exit 1)
external/org_golang_google_genproto/googleapis/rpc/status/status.pb.go:83:0: inconsistent definition for type "google.golang.org/genproto/googleapis/rpc/status".Status during import
	struct { Code int32 "protobuf:\"varint,1,opt,name=code\" json:\"code,omitempty\""; Message string "protobuf:\"bytes,2,opt,name=message\" json:\"message,omitempty\""; Details []*any.Any "protobuf:\"bytes,3,rep,name=details\" json:\"details,omitempty\""; XXX_NoUnkeyedLiteral struct {} "json:\"-\""; XXX_unrecognized []byte "json:\"-\""; XXX_sizecache int32 "json:\"-\"" } (in "github.com/JimLarson/repro1/foo")
	struct { Code int32 "protobuf:\"varint,1,opt,name=code\" json:\"code,omitempty\""; Message string "protobuf:\"bytes,2,opt,name=message\" json:\"message,omitempty\""; Details []*any.Any "protobuf:\"bytes,3,rep,name=details\" json:\"details,omitempty\"" } (in "google.golang.org/grpc")
GoCompile: error running subcommand: exit status 1

I previously had problems getting the proto using Status to compile. A workaround is applied in commit number 2. (6fa7ba8a6a542feb34245e119a02c40f6c71d8e8).

See also issue 1445?

@jayconrod
Copy link
Contributor

This conflict is happening because the @io_bazel_rules_go//proto:go_grpc plugin adds an implicit dependency on libraries which transitively depend on @org_golang_google_genproto//googleapis/rpc/status:go_default_library, which is a go_library built from pre-generated .pb.go files.

I don't have a simple workaround to offer for this. We need to extract all the go_library dependencies out of the proto rules.

@JimLarson
Copy link
Author

I've got a lousy workaround - in my explicit go_proto_library rule, use a non-standard importpath, so Go sees them as different entities.

@mj-hd
Copy link

mj-hd commented Jun 8, 2018

I cloud workaround this by fixing vendored dependencies version to go_rules' dependencies version written here.

@jayconrod
Copy link
Contributor

This should be working now with the changes related to #1548. Please try rules_go and Gazelle 0.13.0 when they are tagged in the next day or two (or try master now) and reopen this if you still have issues.

JimLarson pushed a commit to JimLarson/cel-go that referenced this issue Jul 13, 2018
Use Go proto libraries exported from cel-spec.

Note that we use a different Go package for the google.rpc.Status message
than is specified in its .proto file.  We do this to avoid a different
and incompatible Go proto library that is brought in by the Bazel rules.
We will revert to the right package when this bug is fixed.
See bazelbuild/rules_go#1530

Expand common.Source to subsume interpreter.Metadata, for the latter's
eventual deprecation, and to allow the checker inputs to be constructed
without access to the source text.

Introduce a specialized traits.Lister for arrays of ref.Value values.

Implement CelService server and tests.  Includes conversion between
ref.Value types and protos.
JimLarson added a commit to google/cel-go that referenced this issue Jul 13, 2018
CelService server for cel-go.

Use Go proto libraries exported from cel-spec.

Note that we use a different Go package for the google.rpc.Status message
than is specified in its .proto file.  We do this to avoid a different
and incompatible Go proto library that is brought in by the Bazel rules.
We will revert to the right package when this bug is fixed.
See bazelbuild/rules_go#1530

Expand common.Source to subsume interpreter.Metadata, for the latter's
eventual deprecation, and to allow the checker inputs to be constructed
without access to the source text.

Introduce a specialized traits.Lister for arrays of ref.Value values.

Implement CelService server and tests.  Includes conversion between
ref.Value types and protos.
@JimLarson
Copy link
Author

Bazel + Go + gRPC still doesn't work, but leaving this closed as the current problem is covered by another issue: pubref/rules_protobuf#237

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants