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

Ambiguous imports with cloud.google.com/go/compute/metadata #304

Closed
nikhita opened this issue Jan 5, 2023 · 0 comments · Fixed by #305
Closed

Ambiguous imports with cloud.google.com/go/compute/metadata #304

nikhita opened this issue Jan 5, 2023 · 0 comments · Fixed by #305
Assignees

Comments

@nikhita
Copy link
Member

nikhita commented Jan 5, 2023

Ref: kubernetes/kubernetes#113366, kubernetes/kubernetes#114829

On merging kubernetes/kubernetes#114822, the publishing-bot failed on running go mod tidy - kubernetes/kubernetes#56876 (comment):

+ go mod tidy
    	k8s.io/kube-aggregator/pkg/cmd/server imports
    		k8s.io/apiserver/pkg/server/options imports
    		k8s.io/apiserver/pkg/storage/storagebackend/factory imports
    		go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc tested by
    		go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.test imports
    		google.golang.org/grpc/interop imports
    		golang.org/x/oauth2/google imports
    		cloud.google.com/go/compute/metadata: ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules:
    		cloud.google.com/go v0.97.0 (/go-workspace/pkg/mod/cloud.google.com/[email protected]/compute/metadata)
    		cloud.google.com/go/compute/metadata v0.2.0 (/go-workspace/pkg/mod/cloud.google.com/go/compute/[email protected])

googleapis/google-cloud-go#6311 made compute/metadata its own module. This commit exists also exists on:

  • v0.105.0 of the root module (cloud.google.com/go)
  • v1.12.0 of cloud.google.com/go/compute

If a repo already depends on a version of cloud.google.com/go < v0.105.0 and tries to import cloud.google.com/go/compute/metadata, it'll hit the problem of ambiguous imports while running go mod tidy - golang/go#27899 (another example - ugorji/go#279).

Note: apiserver requires v0.97.0 of the root module - https://github.com/kubernetes/kubernetes/blob/293bf70916de8ef61d5f868f53959f1e15b3e091/staging/src/k8s.io/apiserver/go.mod#L60

To resolve this, we either need to:

  1. pin cloud.google.com/go to a version which includes the cloud.google.com/go/compute/metadata module i.e. > v0.105.0
  2. Run an explicit go get cloud.google.com/[email protected] before running go mod tidy.

For (1), it brings in additional changes that we might not want right now (like bumping genproto). So we go ahead with (2) until we are ready to bump cloud.google.com/go or remove the dependency on it.

/assign

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

Successfully merging a pull request may close this issue.

1 participant