-
Notifications
You must be signed in to change notification settings - Fork 28
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
Synchronize dependencies of a gx-go link
package with another one to avoid discrepancies
#46
Comments
@Stebalien WDYT? |
This is probably the correct way to fix this.
👍. On unlink, the user can fix everything themselves (e.g., with
This seems brittle. The "fix" option, as far as I know, just lists the go deps, finds anything that starts with We actually discussed this with @frrist at lunch today. One thought is to do the linking inside the vendor directory to avoid messing with other packages. That is:
|
Great, I'll take a close look at
Could you expand on this please? If the linked package is already in the |
Basically, we need the dependency names to match up. That is, if I'm using The idea here is that we'd temporarily symlink By doing this in
Note: this won't allow us to use |
Ok, I think I get it now, I agree, although there seems to be two different (but related) problems on the table:
@Stebalien So, if you approve it, I can first submit a PR for the first issue and once I get that working I can attempt your solution for the second problem. |
The current abstraction is actually linking the dvcs version of the package into the global namespace. The problem here is that fixing 1 invalidates this abstraction. |
Sorry, I was unclear that I was stating my own (arbitrary) mental model where I think of a package being linked against another package, but I was saying that this is a misconception, it's just my own way of abstracting myself from the real fact that we're actually linking a package against the global namespace.
My proposed solution just automated what any developer already did manually, and yes that may break other dependencies on the modified package but not more than what you already gets broken when the developer temporarily runs a |
So, this seems to be working in #48 (WIP), as I was thinking about it, Implicit in all this logic is that we are now indeed linking one package against another, that is, have a parent package not use its dependency (child) package obtained through IPFS but instead a git-cloned repo (of the same package with a -potentially- more recent version). We're no longer linking in the global workspace. I would like to make this the default behavior, given that The bottom line is that it will make the code much more clear and easy to reason about if I can always assume that when using @Stebalien Are you ok with this modification in the API? |
(Assumed the answer was yes and went ahead with the changes.) |
While testing the vendor-type implementation of I'm linking
@Stebalien Thoughts? |
Damn. I we'll have to link everything for this to work. See: https://github.com/golang/proposal/blob/master/design/25719-go15vendor.md#proposal Note: This will work with #49 as we do link everything with that change. |
Let's drop the vendoring for now. It'll break some workflows but I'm not sure if there's anything we can do about that. |
Ok, I'll submit a separate PR just for the |
Why? |
Actually, it shouldn't break anything that wasn't already broken. Nevermind. |
So, linking everything is still on the table? That would mean linking all the dependencies in the tree or just the dependencies of the root package? |
As discussed in ipfs/go-unixfs#4 (the main scenario being: I'm working on a git-cloned
go-unixfs
repo and I want to build it againstgo-unixfs
so Igx-go link
it but then there are dependency discrepancies), when usinggx-go link
the dependencies mismatch don't allow to build thego-ipfs
repo against the linked dependency.As a temporary solution I would like to add an (experimental) feature in the
gx-go rewrite
command to use the dependencies of a parent repository (e.g.,go-ipfs
) instead of its own when there's a dependency mismatch. This is somewhat of an already implicit (unpremeditated) functionality, as rewrite map collisions are already handled by overwriting themselves (#44).The tricky part is how to handle the reverse (
--undo
) process. Since we may have built the rewrite map using dependencies of another package, if that package is modified (some of its dependencies changed/updated), the old rewritten dependencies may not match any of the dependencies in the new rewrite map and they won't get reverted (I'm not sure if the--fix
functionality can be of use here).So, a few options, keeping in mind that this is (hopefully) a temporary solution while bigger design decisions are being made in whyrusleeping/gx#179:
Don't bother with the un-rewrite process, since this feature is intended to be used with the
gx-go link
command over git-controlled repos, so the rewrite can be reverted with git.Do the
rewrite --undo
, but leave the burden on the user to keep track of which version of the parent package it used to sync the dependencies.(My personal favorite.) Save the rewrite map (something that I think would be desirable in many scenarios besides this one) and revert the imports based on that and do not re-read the linked package dependencies or any other parent package used to sync them. This could be save as a JSON file under the
.gx/
directory.The text was updated successfully, but these errors were encountered: