Skip to content

go-autorest ambiguous module  #3137

@devigned

Description

@devigned

If you are building a project with a dependency on distribution/distribution and another dependency which uses a go-autorest version after go-autorest was broken into sub modules, there will be a ambiguous import found which causes go mod to fail.

Here's an example where the project has a dependency on this project and we try to add a dependency on sigs.k8s.io/cluster-api-provider-azure.

davidjustice at extremis in ~/code/devigned/go-autorest-mods-test on master [+!?]
$ go get github.com/docker/distribution@v0.0.0-20191216044856-a8371794149d
go: downloading github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
go: downloading github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420
go: downloading github.com/opencontainers/image-spec v1.0.0

davidjustice at extremis in ~/code/devigned/go-autorest-mods-test on master [+!?]
$ go get sigs.k8s.io/cluster-api-provider-azure
go: downloading sigs.k8s.io/cluster-api-provider-azure v0.4.0
go: sigs.k8s.io/cluster-api-provider-azure upgrade => v0.4.0
go: downloading sigs.k8s.io/cluster-api v0.3.0
go: downloading sigs.k8s.io/controller-runtime v0.5.0
go: downloading github.com/Azure/go-autorest v10.8.1+incompatible
../../../go/pkg/mod/sigs.k8s.io/cluster-api-provider-azure@v0.4.0/cloud/errors.go:20:2: ambiguous import: found package github.com/Azure/go-autorest/autorest in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest)
	github.com/Azure/go-autorest/autorest v0.10.0 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest@v0.10.0)
../../../go/pkg/mod/github.com/!azure/azure-sdk-for-go@v40.4.0+incompatible/services/compute/mgmt/2019-12-01/compute/availabilitysets.go:23:2: ambiguous import: found package github.com/Azure/go-autorest/autorest/azure in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest/azure)
	github.com/Azure/go-autorest/autorest v0.10.0 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest@v0.10.0/azure)
../../../go/pkg/mod/sigs.k8s.io/cluster-api-provider-azure@v0.4.0/cloud/scope/clients.go:23:2: ambiguous import: found package github.com/Azure/go-autorest/autorest/azure/auth in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest/azure/auth)
	github.com/Azure/go-autorest/autorest/azure/auth v0.4.2 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest/azure/auth@v0.4.2)
../../../go/pkg/mod/github.com/!azure/azure-sdk-for-go@v40.4.0+incompatible/services/compute/mgmt/2019-12-01/compute/models.go:25:2: ambiguous import: found package github.com/Azure/go-autorest/autorest/date in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest/date)
	github.com/Azure/go-autorest/autorest/date v0.2.0 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest/date@v0.2.0)
../../../go/pkg/mod/sigs.k8s.io/cluster-api-provider-azure@v0.4.0/controllers/azuremachine_reconciler.go:23:2: ambiguous import: found package github.com/Azure/go-autorest/autorest/to in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest/to)
	github.com/Azure/go-autorest/autorest/to v0.3.0 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest/to@v0.3.0)
../../../go/pkg/mod/github.com/!azure/azure-sdk-for-go@v40.4.0+incompatible/services/compute/mgmt/2019-12-01/compute/containerservices.go:24:2: ambiguous import: found package github.com/Azure/go-autorest/autorest/validation in multiple modules:
	github.com/Azure/go-autorest v10.8.1+incompatible (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest@v10.8.1+incompatible/autorest/validation)
	github.com/Azure/go-autorest/autorest/validation v0.2.0 (/Users/davidjustice/go/pkg/mod/github.com/!azure/go-autorest/autorest/validation@v0.2.0)

This is an issue folks are running into as evidenced by this thread https://twitter.com/ibuildthecloud/status/1245061326629556226

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions