-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/vgo: can't build binary that depends on both v1 and v2 of the same library #24851
Comments
What if you create a go.mod in |
@jamie-digital I forked hola to hola-fix and added the go.mod you suggested. Here is the new error:
|
I looks like we're getting much closer. To be honest I'm finding the repo structure a bit hard to understand; the approach I've been using (with no issues) is when I reach v2 of a package I update the existing go.mod's module name to add v2, and I tag the repo with v2.x.y, rather than having both v1 and v2 in the repo at the same time. Note that if you have multiple modules in a single repo you just prefix the tag with the module name (so if you have a repo containing a module in dir What happens if you tag v2 as |
Russ explicitly documented that this structure should work. The reason this structure needs to work is to (1) support the transition to modules and (2) so clients of libraries can gradually upgrade a codebase. As a library owner who currently has a v1 library and is releasing v2, I can neither remove nor move the v1 files because that would break backwards compatibility with the existing tooling.
Same error (and this wouldn't have been an acceptable solution anyway because that tag isn't a proper semver).
I think I have provided enough information here to reproduce the issue. I don't have any more unique knowledge at this point. |
Change https://golang.org/cl/123095 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
Or just create a main.go with this content and run
vgo build main.go
:What did you expect to see?
I expect the build to succeed because github.com/nicksnyder/hola has a structure that mirrors what is documented in this diagram from https://research.swtch.com/vgo-module
What did you see instead?
Attempted workarounds
I tried to manually pin hola to v2, but I get a different (unexpected) error then.
This is a possible duplicate of #24687 (comment) but I wanted to file a fresh set of reproduction steps.
The text was updated successfully, but these errors were encountered: