Need help with godep?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

5.6K Stars 485 Forks Other 328 Commits 79 Opened issues


dependency tool for go

Services available


Need anything else?

Contributors list

Godep - Archived

Please use dep or another tool instead.

The rest of this readme is preserved for those that may still need its contents.

Build Status


godep helps build packages reproducibly by fixing their dependencies.

This tool assumes you are working in a standard Go workspace, as described here. We expect godep to build on Go 1.4* or newer, but you can use it on any project that works with Go 1 or newer.

Please check the FAQ if you have a question.

Golang Dep

The Go community now has the dep project to manage dependencies. Please consider trying to migrate from Godep to dep. If there is an issue preventing you from migrating please file an issue with dep so the problem can be corrected. Godep will continue to be supported for some time but is considered to be in a state of support rather than active feature development.


go get

How to use godep with a new project

Assuming you've got everything working already, so you can build your project with

go install
and test it with
go test
, it's one command to start using:
godep save

This will save a list of dependencies to the file

and copy their source code into
when using older versions of Go). Godep does not copy:
  • files from source repositories that are not tracked in version control.
  • *_test.go
  • testdata
  • files outside of the go packages.

Godep does not process the imports of

files with either the
build tags.

Test files and testdata directories can be saved by adding


Read over the contents of

and make sure it looks reasonable. Then commit the
directories to version control.

The deprecated

For older versions of Go, the

flag tells save to automatically rewrite package import paths. This allows your code to refer directly to the copied dependencies in
. So, a package C that depends on package D will actually import
. This makes C's repo self-contained and causes
go get
to build C with the right version of all dependencies.

If you don't use

, when using older version of Go, then in order to use the fixed dependencies and get reproducible builds, you must make sure that every time you run a Go-related command, you wrap it in one of these two ways:
  • If the command you are running is just
    , run it as
    godep go ...
    , e.g.
    godep go install -v ./...
  • When using a different command, set your
    godep path
    as described below.

isn't necessary with go1.6+ and isn't allowed.

Additional Operations



godep restore
installs the package versions specified in
to your
. This modifies the state of packages in your
godep restore
leaves git repositories in a detached state.
+ no longer checks out the master branch when doing a
go get
, see here.

If you run

godep restore
in your main
go get -u
will fail on packages that are behind master.

Please see the FAQ section about restore.

Edit-test Cycle

  1. Edit code
  2. Run
    godep go test
  3. (repeat)

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
    godep save ./...

Update a Dependency

To update a package from your

, 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/...
. Before comitting the change, you'll probably want to inspect the changes to Godeps, for example with
git diff
, and make sure it looks reasonable.

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.

File Format

Godeps is a json file with the following structure:

type Godeps struct {
  ImportPath   string
  GoVersion    string   // Abridged output of 'go version'.
  GodepVersion string   // Abridged output of 'godep version'
  Packages     []string // Arguments to godep save, if any.
  Deps         []struct {
    ImportPath string
    Comment    string // Description of commit, if present.
    Rev        string // VCS-specific commit ID.

Example Godeps:

  "ImportPath": "",
  "GoVersion": "go1.6",
  "Deps": [
      "ImportPath": "",
      "Rev": "28676070ab99"
      "ImportPath": "",
      "Rev": "3380ade90f8b0dfa3e363fd7d7e941fa857d0d13"

Migrating to vendor/

Godep supports the Go 1.5+ vendor/ experiment utilizing the same environment variable that the go tooling itself supports (


godep mostly works the same way as the

command line tool. If you have go 1.5.X and set
or have go1.6.X (or devel)
is enabled. Unless you already have a
. This is a safety feature and godep warns you about this.


is enabled godep will write the vendored code into the top level
directory. A
file is created to track the dependencies and revisions.
is not compatible with rewrites.

There is currently no automated migration between the old Godeps workspace and the vendor directory, but the following steps should work:

# just to be safe

restore currently vendored deps to the $GOPATH

$ godep restore

The next line is only needed to automatically undo rewritten imports that were

created with godep save -r.

$ godep save -r=false

Remove the old Godeps folder

$ rm -rf Godeps

If on go1.5.X to enable vendor/


re-analyze deps and save to vendor/.

$ godep save

Add the changes to your VCS

$ git add -A . ; git commit -am "Godep workspace -> vendor/"

You should see your Godeps/_workspace/src files "moved" to vendor/.


  1. Increment the version in
  2. Tag the commit with the same version number.
  3. Update

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.