-
Notifications
You must be signed in to change notification settings - Fork 1k
Dep ensure without any go code in directories #796
Comments
Hey, @lclarkmichalek. Thanks for taking the time to open an issue. 😁 You should be able to run Edit: As far as I know, this is not possible currently.But @sdboyer should be able to confirm. |
Reminder to self: Usage scenarios for build pipeline should be added to the FAQ. |
For what it's worth, I got a little farther using
I was attempting to pre-seed the vendor directory in the image with what's local. That resulted in an almost infinite stack of messages such as the following...
That |
Just came here to voice my support for this feature! Also working with docker, and caching the dependencies would be a huge win. Thank you! |
While we're here, is there a reason this isn't just the default, rather than hiding it behind a I would think that solving the package dependencies should only be necessary when updating the lock file, which should be a separate command (or at least only happen when adding/updating dependencies). |
I'm with @amacneil on this, it shouldn't try to be smart except on an update, not on ensure (also wonder why it's called ensure instead if install like everything other package manager).. |
@amacneil @treeder so, all of this - names, flags, defaults, etc. - is intentional, and we're sticking with the design unless/until it actually proves inadequate, rather than merely unfamiliar. I explained the design, and the related/motivating choice of |
Watched the talk, thanks for sharing. While I like the concept of one command doing everything, I feel like that's just not flexible enough. I think various steps could/should be different commands with
That's just off the top of my head, something along those lines. There's clearly issues with just having |
Thanks for the link, it was helpful. I'm sure you have thought about this much more than we have. I also understand the desire for an I think you can't get away from the fact that there are two operations needed from a package manager regarding state - per your talk, one which updates the state of the world based on all inputs ( So, at this point it's just a case of naming conventions. I agree with your desire to not have unnecessary additional commands with confusing or overlapping responsibilities. However, I think there is an argument to be made that recreating the vendor directory is a common enough operation (especially in build/CI environments) to warrant a first class operation. It also happens that this operation is named My suggestion would be to add a Ultimately it's your choice, but I figured it was worth writing this up since the project readme specifically requests feedback on the developer UX, and this is the most confusing thing I have run into using dep so far. Also, FWIW I found a workaround for this for now by simply adding a single (or even empty) go file to the project root in your Dockerfile. This allows dep to do its thing while maximizing the changes of a docker cache hit:
|
Adding a dummy file is a good idea for a workaround for now. Adding any real source from the app is the problem. You'd have to add a source file that never changes. Maybe even 'RUN echo...' something into place. EDIT: This doesn't appear to work as dep will still read the sourcecode and then decide there's nothing to do. my Dockerfile includes the following...
Dep isn't falling for it...
|
i hear your points, @treeder and @amacneil, but these sorts of changes just aren't on the table right now. it was either a months-ago thing, when we were first articulating this model, or a months-from-now thing, after the model has been in place for a while and we can either consider a 2.0 refactor, or (vastly preferably) when we're talking about the CLI UI for the there are also other considerations, including:
but, let me address some of y'alls' specific points:
this set of commands is mostly equivalent to providing them as flags, vs. top-level commands, becomes a design question, where we're really talking about the user's mental model. more on this at the bottom of this comment.
speed is certainly relevant to the feasibility of a sync-based approach, which is exactly why we focus on having fast routines for verifying synchronization. we have some, but not all of those right now, and are working towards them. Some more on this in the FAQ. tl;dr - there are roadmaps for these things, and i believe we have a lot of headroom to make
and
i certainly find this line of argument more convincing. however, i think it just ends up backing us into a fully separated command set - i can imagine similar arguments being made for e.g. while they certainly have their own interpretation of it, it's worth noting that this sync-based approach is a motivating design behind npm5, and continuing with npm6.
for sure, and the feedback is welcome! it's def not gone the way i would've liked, as we've had docs that are inconsistent with real behavior for some months now. at this point, we're committed to giving the single-command, sync-based approach a fair shot, and #489 fixes a lot of these docs problems alongside the functionality changes.
so, i think this is the big point: focusing on the individual commands is missing the forest for the trees. there are differences from what people are accustomed to with a single command, but different != wrong. the sync-based model is one that i originally floated back in Feb 2016, and it was just an idea, so i didn't really know how feasible it was. as i've discussed it with more pkg mgmt system designers, as i've read through hundreds (thousands, now?) of issues people have raised with pkg mgrs, and as now i am, of course, biased in favor of my own idea. so, let me guide the opposition: the shape of the argument that would convince me sync-based is an error is one that demonstrates why it is a bad idea that, in the default, user-oriented case (emphasis, default - i am not saying e.g. docker layer construction is not important - just that it is OK to sacrifice that CLI UX a tad for these other principles), the tool should aim to always keep the states in sync; that there are useful interstitial, un-synced states that are the norm during development; that these interstitial states are so valuable as to justify the addition of more complex controls onto the tool in order to facilitate the interaction with a larger known good output space. |
@sdboyer where is the info on the sync-based approach in npm? I couldn't find anything on it. Just curious to read about it.
I don't think anybody is saying it's a bad idea, I think we're just saying it's not the right idea for all use cases. Maybe all these flags you're talking about will get us there, but we'll see. @amacneil so I tried your idea of throwing in an empty main file and it doesn't work for me.
Output:
Notice the last part there, dep ensure doesn't do anything, probably because it reads the source and doesn't see any imports, even though the lock file has a bunch set in it. |
TBH, i haven't had time to explore or play with it much, so i can't give a lot more detail. for now, i can point you to twitter conversations. npm may be bringing me out to SF at some point soonish for an impromptu pkg mgmt summit, at which point i expect i'll have a lot more insight.
If that's the argument, then of course I agree - the rest of that sentence/paragraph after what you clipped is expressly noting that this is about balancing the for that day-to-day user use case.
indeed! |
with #489 merged, using -vendor-only I still get "all dirs lacked any go code" error |
yeah, i forgot to carve out specifically this path. i don't have time to do a PR today, but the fix here should, i think, be pretty simple for someone else to do up and test. basically:
we'll also need another test harness case to cover this. it's probably as simple as copying the |
Instead of adding new parameter to checkErrors, i think, we can separate vendorOnly guarded part from runDefault and add new runVendorOnly function with same signature( no need for params actually but to be consistent with other run** functions) and call it before ListPackages. |
@ebati yeah, i like that more. also, the fact that the arg len checker in go for it! |
I'd like to be able to do a
dep ensure
in a directory with just aGopkg.lock
and aGopkg.toml
. All of my dependencies are specified inGopkg.lock
like a good citizen, and I'd like to claim my docker-build-time-tax rebate. This means when I have a Dockerfile likeAt the moment, this is nicht sehr gut, as dep replies
all dirs lacked any go code
. I'd love it if dep could install from my lock file, which is then cachable via docker, before adding my more rapidly changing application code.Usual apologies if this is a dupe (did a search for 'all dirs lacked any go code' and couldn't find anything other than the PR where the warning was introduced)
The text was updated successfully, but these errors were encountered: