-
Notifications
You must be signed in to change notification settings - Fork 18k
x/vgo: migrating the Go community. #24454
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
Comments
One way this can be worked around in the current prototype is for a packages that have release v1+ is to put v2, v3, vN in subdirectories under master, with a modules file in each vN folder. Then for the next year and a half vgo and go can co-exist. The normal go command fetching packages like normal from the vN sub-directories, and vgo style looking for modules in the sub directories. Once the world is mostly vgo based, we can use the ability to separate out the physical file path from the version import path. |
I don't think putting a copy of the code under a /vN subdirectory solves the problem described in this issue. Using go today we can import v3 of the repo with the import path Using /vN subdirectories can help maintain compatibility with non-module aware tools, but it's not straightforward. If one of the dependencies updates its import paths to Let's suppose that Maintaining v3 of this package and making future releases then requires duplicating code changes in the root directory and the /v3 directory until we stop supporting non-vgo tools. Maintaining v2 of this package for both vgo and go probably requires duplicating code changes in the root directory on a v2 branch and the /v2 directory on master. Despite all of the above work to support both go and vgo by |
What about editing Say vgo reported that v3.1.0 is incorrect which I assume is the minimal version determined from the direct dependencies, then we will have to find the corresponding commit on |
@tpng this wouldn't work because |
@marwan-at-work From what I understand in https://research.swtch.com/vgo-tour, downgrading section, you can explicitly require a transitive dependency version. |
@tpgng this is correct. The consuming module gets final say in dependency versions. While transioning many projects will need to specify v0 versions and a hash. There are a few existing bugs in the implementation, but they are are fixable. |
@kardianos @tpng i have made a quick example to clone and run An important question still remains: If a workaround today does exist, how will we do this on a Go-community-scale? Will it be discouraging? |
The problem is that vgo try to convert from other package manager to go.mod without considering the case that some packages tagged with v2+ are not imported using the semantic import path (/v2). To solve this, I guess vgo can use the pseudo-version in the converted go.mod when encountering these packages. Then no user actions are required when they |
I have a patched vgo version which use pseudo-version for converted go.mod. |
that might be a good migration strategy @tpng -- do you see any downsides from it? |
@marwan-at-work If one of your dependencies is using go.mod already and require a v0 or v1 version of jwt-go, then that version will be used instead of the pseudo-version of v3 required from converted package manager. |
The issue #24056 is very similar, if not identical. |
@fd0 yes it does. However, I'm asking a more broad question about how vgo should handle the migration of the entire open source community and not just fixing the broken build. Q: what to do when your transitive dependency has a broken import compatibility. But maybe even more community related questions like:
|
Tell the author about it, send a PR, and don't use that version.
This is not going to be such a big problem for tooling as the code will still be there, available for usage by the tooling. What will happen is that the tooling will support two modes, legacy and vgo, and it will work accordingly based on what it detects. |
@dlsniper i wouldn't know who the author is because i don't know which of my 25 direct dependencies actually use the transitive dependency so that they can update their import paths that is right after jwt-go updates its go.mod. |
@marwan-at-work I'm not really sure I understand this one. The compiler will break giving you a trace to read and see which package API was broken, just like today. And if anything, having the major version in the import path would make it easier to figure out which version is broken. Furthermore, there are prototype tools written to explore the space of API compatibility breaks between version bumps, and while they will not be 100% perfect, they'll be close enough that for most cases this won't matter. Can you please explain where you see this as a problem in the |
@dlsniper perhaps it's better to see what im talking about more practically:
|
I don't think the question I've asked has been answered.
I would hope that yes, you, me, and others will actually help the people that invest their spare time to make all these free, opensource projects we all use to make money with.
Please show me such projects as I'd love to learn from them. Furthermore, if these projects use libraries that are maintained, I don't see where the problems is. There will be a transition period, there will be a new release in each of these projects, likely containing a major version bump, as they should be, and the development will continue. As for testing this, the current vgo implementation is a proof of concept, not the final product, as far as I understand from the proposal or the 7 blog posts. I'll use your example in the coming days but, as I mentioned above, how is this different than today? |
@dlsniper if your question is "how is this different than today" then: in today's world (aka dep) my "awesome-go-project" would build successfully because we don't have the Import Compatibility Rule. Nothing against the Import Compatibility Rule itself, but my concern here is about the migration process for the entire go community which leads me to your following statement:
That's well said and is in awesome spirit :) I am quite excited to be active in this process as well. However, my opinion is that this will not be enough. We should try our best not to have people be frustrated with potentially sloppy upgrades and long-term broken builds. The Go team, and the active Go community as a whole, should plan a graceful migration process that inflicts the least amount of pain to users when upgrading. The bold statement above is basically the essence of my concern and I hope this issue is a place to discuss such graceful process :)
The easiest one to point out is the kubernetes manifest file -- but I bet there are many others in the wild (both open source and closed source). |
This thread is duplicating a bit the discussion on the main proposal issue, which now contains:
I think that will address the objections raised in this issue, but I will leave this issue open for further discussion if people want to. |
The change suggested in my previous comment was released in the most recent Go point releases (Go 1.10.3 and Go 1.9.7). |
I have a specific scenario that makes it hard for me to imagine how the entire Go open source community will have to adapt to vgo.
For those interested to participate in the discussion, please read through the scenario and answer in the context of the scenario so that we don't go off topic. Thanks!
This is my scenario:
I started a new project
github.com/marwan-at-work/awesome-go-project
.Let's say my repo has 35 direct dependencies and 350 transitive dependencies.
Say 25 of my direct dependencies use
github.com/dgrijalva/jwt-go
where it’s currently tagged asv3
but does not havev3
in its import path. Therefore,jwt-go
is a transitive dependency and I'm not 100 percent sure which 25 out of 35 direct dependencies usejwt-go
.When I run
vgo build
for the first time it breaks because of theimport path
rule. The error says:invalid module: github.com/dgrijalva/jwt-go should be v1, not v3 (v3.1.0)
It's important to note, that I am not trying to upgrade any packages, I am simply running
vgo build
for the first time.So what’s the solution here? If I understand correctly, it’s a 3-step solution:
Mr or Ms
dgrijalva
will need to update their repo to include ago.mod
injwt-go
’s root directory to specify a new import path that hasv3
in it. Not that bad. Hopefully they’re online and around to accept PRs.Every single one of the 25 dependencies that use
jwt-go
will need to update their source code to usegit.colasdn.top/dgrijalva/jwt-go/v3
(whether manually or through intended tooling). The update itself is not that hard, but having to wait on 25 authors to migrate might take a long while for me to get to step 3:I can finally now run
vgo build
.Now inflate this scenario to the entire Go community. How will we solve this?
Will package users like myself have to wait on my direct dependencies to update their source code, which they themselves will have to wait on their direct dependencies to migrate to vgo?
What is the strategy for this particular scenario?
Thanks
The text was updated successfully, but these errors were encountered: