Google-cloud-go: pubsub: 1.10 release breaks bazel builds

Created on 1 Mar 2021  路  9Comments  路  Source: googleapis/google-cloud-go

Client

PubSub

Environment

GKE

Go Environment

1.15
Bazel 4.0
rules_go 0.25.1

Expected behavior

Continues to compile

Actual behavior

This is a build error, though we are not actually calling any of these in our code.

external/com_google_cloud_go_pubsub/apiv1/schema_client.go:82:15: undefined: pubsub.SchemaServiceClient
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:148:63: undefined: pubsub.CreateSchemaRequest
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:148:119: undefined: pubsub.Schema
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:165:60: undefined: pubsub.GetSchemaRequest
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:165:113: undefined: pubsub.Schema
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:182:62: undefined: pubsub.ListSchemasRequest
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:223:63: undefined: pubsub.DeleteSchemaRequest
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:236:65: undefined: pubsub.ValidateSchemaRequest
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:271:14: undefined: pubsub.Schema
external/com_google_cloud_go_pubsub/apiv1/schema_client.go:286:65: undefined: pubsub.Schema

Additional context

Without other changes, compiles for <= 1.9

go.mod

cloud.google.com/go v0.78.0
cloud.google.com/go/bigquery v1.16.0
cloud.google.com/go/firestore v1.5.0 // indirect
cloud.google.com/go/logging v1.3.0
cloud.google.com/go/pubsub v1.10.0
cloud.google.com/go/storage v1.14.0
pubsub question

All 9 comments

@derekperkins Are you sure you are pulling in the correct version of go-genproto? Looking at genproto at that version it seems like the symbols should exist.

Looks like that version of rule_go does not depend on a recent enough genproto.

Looks like we have a more recent version in our go.mod.

google.golang.org/api v0.40.0
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705

I'm not sure how that rules_go library fits in. I want to say that it is there if you are generating protos in the bazel build itself, which we are not, but I'm not sure. This is from our bazel dependencies file showing the more recent one.

go_repository(
    name = "org_golang_google_genproto",
    build_file_proto_mode = "disable_global",
    importpath = "google.golang.org/genproto",
    sum = "h1:PYBmACG+YEv8uQPW0r1kJj8tR+gkF0UWq7iFdUezwEw=",
    version = "v0.0.0-20210226172003-ab064af71705",
)

Have you taken a look at Overriding dependencies? I think I have seen this happen in the past with genproto, but I can't find the issue. Overriding the version fixed it if I recall correctly.

TIL there are magic dependencies that supersedes my dependency file. I'm not quite sure how to test this with the http_archive call since there aren't any published releases / tags of genproto.

Looking at rules_go's issues it looks like they plan to bump dependencies before their next release. I have a limited knowledge of how to properly use that ecosystem and this now does seem like more of an issue with rules_go and that build system. I would recommend opening an issue over there for better support. We have confirmed that the 1.10 module depends on an appropriate version of genproto in our go.mod, so I don't think there is any issue from this libraries stand point. Hope this info was useful.

Yes, thank you very much @codyoss. I'll report back after the next release to confirm that it did indeed solve the problem.

For reference, here is the tracking issue in rules_go for upgrading these dependencies https://github.com/bazelbuild/rules_go/issues/2829

We just upgraded our rules_go dependency and I can confirm that it solves this issue.

Was this page helpful?
0 / 5 - 0 ratings