-
Notifications
You must be signed in to change notification settings - Fork 1k
dep ensure local packages #935
Comments
Yes. I'm interested in this as well. Gives you the ability to checkout code anywhere and just build it as one contained unit, rather than having to check it out to a GOPATH to build it relying on the assumption that it has all the external dependencies not already vendored - which seems quite fragile from a project management point of view. |
Came here to ask for this. My projects look something like:
Thanks! |
ugh, i'm sorry, i don't know why i never got around to directly answering this in the first place. thanks for your (multi-month) patience. so, this is a tricky thing for dep to do safely and maintain its safety guarantees. projects like vg may facilitate some hacks sorta in the interim, but the biggest issue here is that trusting arbitrary local state really alters dep's model, and in doing so introduces a lot of new failure modes for us to deal with, and for users to potentially run into. if nothing else, consider this: when we operate only on upstream repositories, we know that the revisions we operate on actually do immutably represent a code tree. if we're looking at local state, though, then what the e.g. git repository says the current revision is doesn't necessarily match the code tree, because it could be dirty (modified files), or just have untracked files that would still be picked up. this effectively means that we don't have a revision we could accurately put into we can make workarounds for these things - other language package managers certainly have, to enable this kind of behavior. and that is something i want to do - but sadly, i've been saying that for ~15 months now, as there's a whole bunch of design issues that would need to be considered for this; other, more targeted issues have continued to be more pressing. tbh, it's likely to continue like that for a while. however, if there's an intrepid Gopher out there who wants to win fame in and love of the entire Go community by taking on the job of grokking the problem and designing out a solution, then i am 💯💯 willing to guide that 🎉 amazing human 🎉 through the process 😄 |
@sdboyer I agree with the possible security flaw in adding local files. |
This may be helpful feature. In lots of case, we use internal package which store in local, but |
other DM tools figure out this problem with
however, in the dev/local environment, we all develop or try to implement new features; most of the iterations end up dirty state with broken things. |
To solve this problem at my company I created virtualgo: https://github.com/GetStream/vg |
I don't understand what you mean with this. If you clone from a local git repository you end up with the same guarantees as cloning from a remote git repository. It doesn't matter whether there are unstaged/dirty files. That's not how git works. |
right, and in this case, that's the problem: what is retrieved into vendor is not the same as what is on in the working tree on disk. however, what's on disk is what many people would be expecting out of this use pattern, because they're looking for a comfortable flow for rapid hacking.
so, either they get the "wrong" code, or we don't move a tree into vendor at all, and they get the "right" code, but the only got commit hash we have to put into Gopkg.lock does not describe reality.
…On January 30, 2018 7:29:37 AM EST, Julian Ospald ***@***.***> wrote:
> if nothing else, consider this: when we operate only on upstream
repositories, we know that the revisions we operate on actually do
immutably represent a code tree. if we're looking at local state,
though, then what the e.g. git repository says the current revision is
doesn't necessarily match the code tree, because it could be dirty
(modified files), or just have untracked files that would still be
picked up.
I don't understand what you mean with this. If you clone from a local
git repository you end up with the same guarantees as cloning from a
remote git repository. It doesn't matter whether there are
unstaged/dirty files. That's not how git works.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#935 (comment)
|
How is that a problem? That is totally expected when working with git. |
asked and answered, please reread
…On January 30, 2018 8:23:56 AM EST, Julian Ospald ***@***.***> wrote:
> what is retrieved into vendor is not the same as what is on in the
working tree on disk. however, what's on disk is what many people would
be expecting out of this use pattern, because they're looking for a
comfortable flow for rapid hacking.
How is that a problem? That is totally expected when working with
**git**.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#935 (comment)
|
I did read it, but it appears to me those are just assumptions. Basically you are excluding a certain kind of git uri scheme, because you think some people might not know what it means. |
Any news on this? |
I'm also interested. @roadrunner put it well:
I keep pushing untested/buggy code to my repo; this is certainly not idiomatic git usage. Ideally I wouldn't even want to commit the code I am testing before I tested it by executing my program. |
@roadrunner / @Adrien-Luxey |
Nope, that's why I'm complaining 😁 |
Like I already commented before, I created (and still use) vg to workaround this issue: https://github.com/GetStream/vg |
@JelteF does it work well with multiple GO versions? |
@krzysztofantczak, not built in. But it should work when you set the GOROOT manually. |
@JelteF yea, i already tested. It works pretty well with GVM ;-) |
In case it is of any help. Node package managers (npm and yarn) work as follows: in the folder of the project that want to be depended on, |
I use a workaround mentioned here: #1775 More specifically, I added this into Gopkg.toml to make "dep ensure" skip download of gocv and let golang compiler use local version from $GOPATH/src/gocv.io/x/gocv:
|
So what if "ignored" in Gopkg.toml could just fall back to an environment variable if not set (or merged with an environment variable if set)? That way in my projects I could just set an environment variable for the packages that I want it to ignore. This way the modified "Gopkg.toml" (adding "ignored") won't accidentally make it into source control, and as a developer I could easily make scripts locally to set the environment variables automatically. |
@kevinburke is this solved? |
I'm not sure, I just went through and closed all old issues yesterday, see #2166. It's entirely possible this is still an issue; it's also possible it's been fixed! |
dep
support create vendor based on local packages?like:
The text was updated successfully, but these errors were encountered: