简体   繁体   中英

How to make sure go build is using all dependencies from vendor directory

I have used godep and vendored all my dependencies in vendor/ directory. Go build is working fine as well. However how can I be sure that all my dependencies are vendored?

Is there any command that can make sure of that?

My CI service ( Travis is the one I use) lets me know. Because my test build will fail if the deps aren't available.

You should be using a CI service anyway, and then you get that benefit for free.

I use govendor to manage the dependencies, which has a status option. Here's some of the commands with govendor:

init     Create the "vendor" folder and the "vendor.json" file.
list     List and filter existing dependencies and packages.
add      Add packages from $GOPATH.
update   Update packages from $GOPATH.
remove   Remove packages from the vendor folder.
status   Lists any packages missing, out-of-date, or modified locally.
fetch    Add new or update vendor folder packages from remote repository.
sync     Pull packages into vendor folder from remote repository with revisions
             from vendor.json file.
migrate  Move packages from a legacy tool to the vendor folder with metadata.

Specifically, you'd do govendor status to check if there are missing packages.

If you decide to use govendor, you can get started by doing:

  • go get github.com/kardianos/govendor
  • govendor migrate (which will migrate from godeps to govendor)

Also, you mentioned in a comment that your deploying to Heroky, here's some documentation from them on govendor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM