Skip to content

Conversation

devigned
Copy link
Contributor

@devigned devigned commented Apr 1, 2020

This updates the go-autorest related dependencies to a recent version which will fix the ambiguous module error.

fixes #3137

@cpuguy83
Copy link
Contributor

ping @dmcgowan

@dmcgowan
Copy link
Collaborator

@cpuguy83 this change really doesn't make much sense to me, I have no idea what go mod is doing here. If I understand it correctly, github.com/Azure/go-autorest/autorest switched to go mod and in the process broke up subpackages into separate go mods with different version? I tried to pull down locally and see if go mod explained it, but still confused. This needs to be reviewed by Azure maintainers, I'll go along with their advice.

@devigned
Copy link
Contributor Author

I tried to explain this in the issue, but I don't think I did a very good job. I'll try once more. If a call is needed, I'm happy to discuss with anyone that is interested.

Let's looks at the error from the issue:

../../../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)

Basically, golang found what it thinks is the same module in two places, the earlier incompatible go-autorest and more recent, modularized go-autorest/autorest module. This error occurs when someone takes a dependency on the pre golang module go-autorest, the core dependency of all Azure Golang SDKs, and a project that depends on the modularized go-autorest. This happens because the pre golang module package contains the import path defined in go-autorest/autorest, and many of the other import paths which have since been broken out into their own modules. You can see a list of the modules here. Most of these import paths defined in these modules will overlap with the pre modular go-autorest.

The error above is from an example project that takes a dependency on this project and cluster-api-provider-azure. This project depends on the pre golang module version of go-autorest, and cluster-api-provider-azure uses the modularized version. One can easily repro this behavior by creating a new golang mod based project and import these two projects.

The way to "fix" the situation is to update the outdated go-autorest dependency in this project.

Again, happy to help get this resolved. Cheers!

@nojnhuh
Copy link

nojnhuh commented Jun 15, 2020

Giving this a bump as I ran into the same problem and would like to avoid adding a replace in go.mod if I can.

Base automatically changed from master to main January 27, 2021 15:51
@johnsonshi
Copy link

Bump - also just ran into this issue

@milosgajdos
Copy link
Member

You need to rebase @devigned

@devigned
Copy link
Contributor Author

@milosgajdos this has been open for a long time. If I rebase the changes, will this be able to pulled in?

@milosgajdos
Copy link
Member

@devigned can't promise any swift action -- I saw a new issue update and noticed this PR has a conflict, so if it does come to review it'd have to be conflict free

@devigned
Copy link
Contributor Author

@devigned can't promise any swift action -- I saw a new issue update and noticed this PR has a conflict, so if it does come to review it'd have to be conflict free

Right on. I'll rebase it and hopefully, we can get it pulled in.

@devigned
Copy link
Contributor Author

@milosgajdos I've updated the deps to the latest versions, vendored, and tidied up. I think this should be ready for review and verification. If there are questions about why this is needed, I'm happy to answer questions. I've tried to sum it up above, but totally get that go mods can be a bit confusing in edge cases like what's going on here.

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2021

Codecov Report

Merging #3138 (819b122) into main (eda4e71) will decrease coverage by 0.05%.
The diff coverage is n/a.

❗ Current head 819b122 differs from pull request most recent head 3e68d47. Consider uploading reports for the commit 3e68d47 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3138      +/-   ##
==========================================
- Coverage   56.38%   56.33%   -0.06%     
==========================================
  Files         102      101       -1     
  Lines        7324     7280      -44     
==========================================
- Hits         4130     4101      -29     
+ Misses       2541     2527      -14     
+ Partials      653      652       -1     
Impacted Files Coverage Δ
.../github.com/distribution/distribution/uuid/uuid.go

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eda4e71...3e68d47. Read the comment docs.

@cpuguy83
Copy link
Contributor

Anything blocking this?

@milosgajdos milosgajdos requested a review from wy65701436 July 20, 2021 06:39
@devigned
Copy link
Contributor Author

@milosgajdos or @wy65701436 is there anyway this could get a review and just maybe get pulled in?

@milosgajdos milosgajdos requested a review from thaJeztah August 25, 2021 14:45
Signed-off-by: David Justice <david@devigned.com>
Copy link
Collaborator

@wy65701436 wy65701436 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@milosgajdos milosgajdos merged commit 677772e into distribution:main Aug 26, 2021
@devigned devigned deleted the autorest-update branch August 26, 2021 11:43
@devigned
Copy link
Contributor Author

Thank you so much for getting these changes merged!

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

Successfully merging this pull request may close these issues.

go-autorest ambiguous module
9 participants