Should I add go dep
vendor/
folder to .gitignore
?
Now I have vendor/
in .gitignore
, so every deploy will call dep ensure
The general recommendation is no. The vendor directory (or wherever your dependencies are installed) should be added to . gitignore / svn:ignore /etc. The best practice is to then have all the developers use Composer to install the dependencies.
When dependencies are kept to a minimum, it's easy to commit the entire vendor folder without incurring the huge data cost that the average node_modules folder would demand.
Normally yes, . gitignore is useful for everyone who wants to work with the repository. On occasion you'll want to ignore more private things (maybe you often create LOG or something. In those cases you probably don't want to force that on anyone else.
js land, Golang's vendor directory is basically the same as Node's node_modules . It is a directory found at the root of a Go module that stores a copy of all the code the module depends on. The vendored code is used to compile the final executable when the go build command is run.
github/gitignore/Go.gitignore
doesn't add vendor/
to its .gitignore
file.
This causes its content should be versioned, recorded in the Git repository, instead of being potentially generated, and may respond to the following needs:
On the other hand, gitignore.io/api/go
does add vendor/
to its .gitignore
.
So in conclusion, you might as well ignore it if you're not under any of the situations stated above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With