-
Notifications
You must be signed in to change notification settings - Fork 1k
Vendor only the used packages in a dependency repository #625
Comments
I just discovered the |
I've recently sorta relented on this and have accepted as a TODO making pruning the default. But this whole area gets sticky and complicated if we want to make it safe (which is our primary goal), and is the topic of #120 😄 (Closing as dup) |
@ahmetb I have small make target
|
I'm using .gitignore to avoid unnecessary files in vendor/ directory:
|
The gitignore snippet from @VojtechVitek wouldn't work in my case - and probably most cases - because the first line will ignore all directories under
(Spent some time figuring out why wouldn't Git see anything inside my vendor directory.) |
the gitignore approach is long since outdated, thanks to pruning. |
Pruning doesn’t remove non-Go files and test files. Which I think is correct, but I prefer removing them. For reference, this is the “conversion” of the .gitignore above into a shell script.
|
'non-go' and 'go-tests' are two of the three types of pruning supported by dep: https://golang.github.io/dep/docs/Gopkg.toml.html#prune |
sounds like you're on an old version. see the release announcement: https://golang.github.io/dep/blog/2018/01/23/announce-v0.4.0.html
…On February 7, 2018 12:02:00 PM EST, Leonid Shevtsov ***@***.***> wrote:
Pruning doesn’t remove non-Go files and test files. Which I think is
correct, but I prefer removing them.
For reference, this is the “conversion” of the .gitignore above into a
shell script.
```
find vendor -type f -not -name "*.go" -not -name "LICENSE" -not -name
"COPYING" -or -name "*_test.go" | xargs rm -f
```
--
You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub:
#625 (comment)
|
I am trying to figure out how can I make sure I only vendor a particular package from a huge repository my project depends on.
For example consider this simple program with
main.go
and nothing else:I then run
dep init
on this directory to initialize Gopkg files. This simple dependency yields in 2,129,065 lines of code to be vendored. Is this by design?If I use
govendor
/godep
this is not the case as those tools can figure out what packages are used in the build and vendor only those. Am I doing something wrong?The text was updated successfully, but these errors were encountered: