-
Notifications
You must be signed in to change notification settings - Fork 1k
Prune should remove contents of root package directory when only subpackages are used #1113
Comments
@kevinburke Am I summarizing correctly that you were expecting the root package contents (e.g. |
ohh interesting - yeah prune does need to empty out leading dirs that have to be there for structural purposes/because subdirs are required. |
Carolyn - yes, that's correct
On Fri, Sep 1, 2017 at 13:41 sam boyer ***@***.***> wrote:
ohh interesting - yeah prune does need to empty out leading dirs that have
to be there for structural purposes/because subdirs are required.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1113 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAOSI-aTv4LykxZh0Men1_mp9LclG0z_ks5seGvbgaJpZM4PKmZ4>
.
--
…--
Kevin Burke
925.271.7005 | kev.inburke.com
|
#1020 does this in the |
@ibrasho Is there a test in that PR that demonstrates unused packages being pruned? |
Not yet. It was in the original PR. I'm still working on completing #1020. |
Since this is a separate issue... 😁 Which files should be deleted in an "usused" package? Pruning options will be definable per-project, so this should pose a small issue anyway. |
@sdboyer I'm not sure about deleting symlinks tbh. If a package relies on symlinks for package name this could cause unexpected issues. |
This also causes a poor interaction with Bazel. For example, I only need More discussion here: bazel-contrib/rules_go#725 |
I would expect the following behavior for After running this command, all files in
Everything else (go code or not) that is in the vendor folder, but does NOT influence the compilation of the actual project and is not there for the first 2 reasons is useless and must be removed from the vendor folder. This would solve issues deciding what should be kept: optional dependencies (library A depends on library B in some cases, but the actual project doesn't use these parts of library A anyways), symlinks (if they are not present and the project still compiles the same way, they are not necessary), random other files ( |
oh, this is fixed now. @MarkusTeufelberger pruning behavior is now established. fixes are possible, of course, but they need to be in a new issue. (and I'm not actually sure if you're trying to propose a change to the v0.4.1 behavior here) |
Neither am I, is it documented somewhere in detail? #1580 for example sounds like it is not working as I would expect it to work (vendored testdata or vendored tests in general shouldn't be able to influence the outcome of a compilation). "unused-packages indicates that files from directories that do not appear in the package import graph should be pruned." from https://golang.github.io/dep/docs/Gopkg.toml.html#prune sounds close, I guess I'm proposing an "unused-files indicates that all files that do not cause a change in the resulting package should be pruned." I can of course open an issue, if that sounds like a reasonable proposal. |
you linked to the docs we have so far. writing up a section to further explore pruning is a TODO. that specific issue is a bit of an oddity, and is more of a bug than anything. however, it is not the case that we can necessarily assume testdata can be discarded - it is a terrible idea, but not disallowed to import from non-test Go code (and I've seen it in the wild in some protobuf library somewhere). so, we can't really treat the contents of those directories specially with respect to pruning rules. how is what you're describing different from (actually, yes, please open a new issue for this, and answer that question there 😊) |
See #1614 |
What version of
dep
are you using (dep version
)?v0.1.0-585-g34835a5
What
dep
command did you run?dep init; dep ensure; dep prune.
I've set up a test repository with the results here: https://github.com/kevinburke/dep-test-bson
What did you expect to see?
I expected the vendor directory to have the following contents (and only the following contents)
vendor/gopkg.in/mgo.v2/bson/*
vendor/gopkg.in/mgo.v2/internal/json/*
What did you see instead?
I see all of the files and contents in the gopkg.in/mgo.v2 package as well:
The text was updated successfully, but these errors were encountered: