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

Bazel using wrong version of @org_golang_google_genproto when updating cloud.google.com/go/storage to v1.8.2 #1153

Open
pwaterz opened this issue Jan 4, 2022 · 1 comment

Comments

@pwaterz
Copy link

pwaterz commented Jan 4, 2022

What version of gazelle are you using?

I tested this on .22, .23, and .24

What version of rules_go are you using?

Tested on respective versions outlined in the README. .24, .28, and .29

What version of Bazel are you using?

4.2.2

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Ubuntu and x86-64.

What did you do?

I updated cloud.google.com/go/storage from v1.6.0 to v1.8.2

go get go get cloud.google.com/go/storage
bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=repositories.bzl%go_repositories
bazel run //:gazelle
bazel test //...:all

What did you expect to see?

I expected my tests to run successfully.

What did you see instead?

[HIDDEN]/external/com_google_cloud_go_storage/BUILD.bazel:3:11: no such package '@org_golang_google_genproto//googleapis/storage/v2': BUILD file not found in directory 'googleapis/storage/v2' of external repository @org_golang_google_genproto. Add a BUILD file to a directory to mark it as a package. and referenced by '@com_google_cloud_go_storage//:go_default_library'

The version of genproto in my repositoies is

go_repository(
        name = "org_golang_google_genproto",
        importpath = "google.golang.org/genproto",
        sum = "h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0=",
        version = "v0.0.0-20211208223120-3a66f561d7aa",
    )

Which does have googleapis/storage/v2, It appears it's not using the correct version.

@countravioli
Copy link

bazel version: 3.4.1
go version: 1.15.5

This is happening to me as well. Digging into the bazel cache it looks to me like the target is being sourced from the wrong repository?

deps.bzl

    go_repository(
        name = "com_google_cloud_go_storage",
        importpath = "cloud.google.com/go/storage",
        sum = "h1:5NQw6tOn3eMm0oE8vTkfjau18kjL79FlMjy/CHTpmoY=",
        version = "v1.18.2",
    )
    go_repository(
        name = "org_golang_google_genproto",
        importpath = "google.golang.org/genproto",
        sum = "h1:Et6SkiuvnBn+SgrSYXs/BrUpGB4mbdwt4R3vaPIlicA=",
        version = "v0.0.0-20220107163113-42d7afdf6368",
    )

Looking in my bazel cache at com_google_cloud_go_storage it looks like it's dep should probably be on the repo @org_golang_google_api not @org_golang_google_genproto. For context v1:storage and a bunch of other apis are at the other repository.

        "@org_golang_google_api//googleapi",
        "@org_golang_google_api//iamcredentials/v1:iamcredentials",
        "@org_golang_google_api//iterator",
        "@org_golang_google_api//option",
        "@org_golang_google_api//option/internaloption",
        "@org_golang_google_api//storage/v1:storage",
        "@org_golang_google_api//transport",
        "@org_golang_google_api//transport/http",
        "@org_golang_google_genproto//googleapis/storage/v2:storage",

I'm still pretty novice with bazel and golang. Does the go_repository macro basically download the source and then inject WORKSPACE and BUILD files to "bazelify" for these third party dependencies?

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

No branches or pull requests

2 participants