godep

https://github.com/tools/godep

$ godep save

This will save a list of dependencies to the file Godeps/Godeps.json and copy their source code into vendor/ (orGodeps/_workspace/ when using older versions of Go).

Restore

The godep restore installs the package versions specified in Godeps/Godeps.json to your $GOPATH. This modifies the state of packages in your $GOPATH. NOTE: godep restore leaves git repositories in a detached state. go1.6+ no longer checks out the master branch when doing a go get, see here.

Add a Dependency

To add a new package foo/bar, do this:

  1. Run go get foo/bar
  2. Edit your code to import foo/bar.
  3. Run godep save (or godep save ./...).

Update a Dependency

To update a package from your $GOPATH, do this:

  1. Run go get -u foo/bar
  2. Run godep update foo/bar. (You can use the ... wildcard, for example godep update foo/...).

Multiple Packages

If your repository has more than one package, you're probably accustomed to running commands like go test ./...,go install ./..., and go fmt ./.... Similarly, you should run godep save ./... to capture the dependencies of all packages in your application.

关于 liuzhantao

北京互联网求职群:168047123
此条目发表在 godep 分类目录。将固定链接加入收藏夹。