-
Notifications
You must be signed in to change notification settings - Fork 57
Exclusion patterns proposal #54
Comments
We've never hit the problem you're describing (probably because we always use trash to vendor dependencies), but I can see where it comes from. Directly using a library that has vendored code and using any of that library's vendored packages directly is calling for trouble. There are a couple workarounds:
In any case, if you use trash as your app's vendoring tool, you have to add all (including transitive) dependencies to your app's That said, I'm not decided on this proposal, yet (a real life example would help). For now, it's more "no" than "yes". |
The real life example: We're the authors of Since we don't control end user applications, only our codebase, we can't just tell people to use trash themselves too. That is the main feature of My end goal is to allow go-ethereum to be |
@karalabe The code is in. Cutting a new release soon! Thanks for sharing the use case: a concrete example really helps to look at things in perspective. |
While working with trash we noticed an interesting corner case that the concept of vendoring introduces but that trash cannot handle currently:
As vendoring essentially creates new import paths (that the compiler resolves internally, but new nonetheless), vendored types are different from the same types directly imported from the outside. This means that if I create a library, the API must never contain vendored types, as those are private to the library (similar to
internal
).Now this in general is just good practice, that you don't expose internal stuff. There's one common catch though, the
golang.org/x/net/context
package. Go APIs in general always use this package when a context needs to be passed in, but vendoring it will make it impossible to create (since the API's real type will bemypackage/vendor/golang.org/x/net/context
). The standard solution is to never vendor ingolang.org/x/net/context
, as it won't ever change in the foreseeable future.Now you might say that Go 1.7+ standardized this
context
so there's no need for the external package any more, but while that's true, using it would break all builds prior to Go 1.7, which is a bit too much given that 1.7 is the newest. Maybe we can do that in a couple versions after 1.9 appears.Given all this, the hackish solution would be to hard code that
golang.org/x/net/context
is always deleted... but that's ugly. A better solution that I'd propose is to add a second configuration group into the yaml file calledblacklist
(or anything really), which contains a list of packages that are always deleted during the cleanup phase.If you think this would be a use case you'd like to have, I'd gladly code it up. Just want to get the green light first before putting any effort into it. Also if you have any particular constraints or wishes regarding it, I'd gladly listen to them :)
The text was updated successfully, but these errors were encountered: