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

Building a target dependent on Envoy go_control_plane (which uses gogoprotobufs) fails #1546

Closed
cdelguercio opened this Issue Jun 13, 2018 · 3 comments

Comments

Projects
None yet
2 participants
@cdelguercio

cdelguercio commented Jun 13, 2018

Envoy's go_control_plane package clearly uses the gogoprotobufs version of googleapis, which I include in my WORKSPACE file. But it seems when I try to build something that depends on it, it looks like it tries to use the google version of googleapis.

/home/chris/.cache/bazel/_bazel_chris/1568f635c686948d7428fc5fdf7009b8/sandbox/474195558422564319/execroot/__main__/external/com_github_envoyproxy_go_control_plane/envoy/api/v2/discovery.pb.go:223:22: this.ErrorDetail.Equal undefined (type *rpc.Status has no field or method Equal)
/home/chris/.cache/bazel/_bazel_chris/1568f635c686948d7428fc5fdf7009b8/sandbox/474195558422564319/execroot/__main__/external/com_github_envoyproxy_go_control_plane/envoy/api/v2/discovery.pb.go:330:58: m.ErrorDetail.Size undefined (type *rpc.Status has no field or method Size)
/home/chris/.cache/bazel/_bazel_chris/1568f635c686948d7428fc5fdf7009b8/sandbox/474195558422564319/execroot/__main__/external/com_github_envoyproxy_go_control_plane/envoy/api/v2/discovery.pb.go:331:27: m.ErrorDetail.MarshalTo undefined (type *rpc.Status has no field or method MarshalTo)
/home/chris/.cache/bazel/_bazel_chris/1568f635c686948d7428fc5fdf7009b8/sandbox/474195558422564319/execroot/__main__/external/com_github_envoyproxy_go_control_plane/envoy/api/v2/discovery.pb.go:433:20: m.ErrorDetail.Size undefined (type *rpc.Status has no field or method Size)
/home/chris/.cache/bazel/_bazel_chris/1568f635c686948d7428fc5fdf7009b8/sandbox/474195558422564319/execroot/__main__/external/com_github_envoyproxy_go_control_plane/envoy/api/v2/discovery.pb.go:686:27: m.ErrorDetail.Unmarshal undefined (type *rpc.Status has no field or method Unmarshal)
GoCompile: error running subcommand: exit status 1

Here's the relevant part of my WORKSPACE file:

http_archive(
    name = "io_bazel_rules_go",
    url = "https://github.com/bazelbuild/rules_go/archive/ca213b3006c8eed6b3f1ea649cab36b817901b46.tar.gz",  # May 14, 2018
    strip_prefix = "rules_go-ca213b3006c8eed6b3f1ea649cab36b817901b46",
    sha256 = "b49b0ca860ab6b203705dc34b5f794003eee3d450f3891227cd6648a648f49fe",
)
http_archive(
    name = "bazel_gazelle",
    url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/0.12.0/bazel-gazelle-0.12.0.tar.gz",  # May 8, 2018
    sha256 = "ddedc7aaeb61f2654d7d7d4fd7940052ea992ccdb031b8f9797ed143ac7e8d43",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
gazelle_dependencies()

go_repository(
    name = "com_github_envoyproxy_go_control_plane",
    importpath = "github.com/envoyproxy/go-control-plane",
    commit = "39c73ae5ba014b648d4164a24340a78b6b761978",  # May 24, 2018
)

# Needed by com_github_envoyproxy_go-control-plane
go_repository(
    name = "com_github_gogo_googleapis",
    importpath = "github.com/gogo/googleapis",
    commit = "b23578765ee54ff6bceff57f397d833bf4ca6869",  # May 1, 2018
)

new_http_archive(
    name = "googleapis_archive",
    build_file = "//third_party:googleapis.BUILD",
    sha256 = "df585427959ebb9949ca12a45888b50a5b8edcb2b270aea1800225d159a49ff6",
    strip_prefix = "googleapis-3273178ea4684acc4f512f7bef7349dd72db88f6",
    urls = ["https://github.com/googleapis/googleapis/archive/3273178ea4684acc4f512f7bef7349dd72db88f6.tar.gz"],
)

I've read a few other issues that seemed similar but nothing stuck out to me as a solution that would work here.

@cdelguercio cdelguercio changed the title from Compiling Envoy (which uses gogoprotobufs) fails to Building a target dependent on Envoy go_control_plane (which uses gogoprotobufs) fails Jun 13, 2018

@jayconrod

This comment has been minimized.

Contributor

jayconrod commented Jun 13, 2018

You likely have a conflict between something that depends on a go_proto_library that uses the default plugin for rpc.Status and a go_proto_library that uses the gogo plugin.

It's probably possible to make this work, but you'd need to have complete control over all of the proto related build rules in your dependency graph. Every go_proto_library will need to be built with the same plugins, and no two libraries should have the same importpath. Unfortunately Gazelle won't do the right thing (and remember, go_repository uses Gazelle internally).

Obviously, this is not a good experience, and we need to do a lot better here. I've been working on a design document, planning an overhaul of proto rule dependencies. I'll post that as an issue later today.

@jayconrod

This comment has been minimized.

Contributor

jayconrod commented Jun 13, 2018

You may find bazel query helpful for discovering unexpected dependency chains. For example, if you want to find what depends on @googleapis_archive//:google_rpc_status_go_proto:

$ bazel query 'somepath(//..., @googleapis_archive//:google_rpc_status_go_proto`
@jayconrod

This comment has been minimized.

Contributor

jayconrod commented Jul 16, 2018

This should be fixed with the changes in 0.13.0. Please reopen if you're still having issues.

@jayconrod jayconrod closed this Jul 16, 2018

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