Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

pkg in vendor includes more unused files, need to clean them #383

Closed
subchen opened this issue Apr 15, 2017 · 1 comment
Closed

pkg in vendor includes more unused files, need to clean them #383

subchen opened this issue Apr 15, 2017 · 1 comment

Comments

@subchen
Copy link

subchen commented Apr 15, 2017

I used dep ensure to download pkgs into vendor directory, and found there are more unused files, such as docs files, test files, etc...

for examples:

vendor/github.com/termie/go-shutil/
├── LICENSE
├── README.rst
├── shutil.go
├── shutil_test.go
└── test
    ├── testdir
    │   ├── file1
    │   └── file2
    ├── testfile
    └── testfile2

If I commit vendor directory into GIT repo (to build without network and speed up), it will be made repo more larger.

In my point, only shutil.go is necessary in my sample for build.

  • includes *.go, *.cgo in pkg, instead of full GIT repo.
  • excludes *_test.go
  • excludes empty dirs

In the past, I used govendor, that can get a clean vendor directory.

vendor/github.com/termie/go-shutil/
├── LICENSE
├── README.rst
└── shutil.go
@sdboyer
Copy link
Member

sdboyer commented Apr 15, 2017

Hi! Thanks for the issue 😄

We refer to this general category of work as "pruning." As of last week, there is a dep prune subcommand that will trim down the contents of your vendor directory, at least somewhat.

However, please do note that that subcommand is unlikely to stick around in the long term, because (to summarize) it presents challenges for verifying package contents, and because we do ultimately view vendor/ as an implementation detail.

#120 is the canonical issue about this - see that for much more information and discussion.

@sdboyer sdboyer closed this as completed Apr 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants