Skip to content

Instantly share code, notes, and snippets.

@chibby0ne
Created March 3, 2018 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chibby0ne/cc3d83eed41307e8beed3a6ed52e0be0 to your computer and use it in GitHub Desktop.
Save chibby0ne/cc3d83eed41307e8beed3a6ed52e0be0 to your computer and use it in GitHub Desktop.
Updating dependencies created by go dep

If you run

dep init

On a project for vendoring its dependencies, the versions choosen by dep for some of the dependencies might not be all that recent or if they are they might not be the versions that you want.

How do you manually change the versions then?

Let's say you have github.com/gliderlabs/ssh in Gopkg.toml with a particular version tag,

[[constraint]]
  name = "github.com/gliderlabs/ssh"
  version = "0.1.0"
  

And suppose that instead of a tag on the repo you want to point to the master branch. In that case you open Gopkg.toml and remove the version line and add a branch line:

[[constraint]]
  name = "github.com/gliderlabs/ssh"
  branch = "master
  

Afterwards open the Gopkg.lock and edit github.com/gliderlabs/ssh project accordingly:

Remove version line, add a branch line and leave the rest of the lines as they were

[[projects]]
  branch = "master"
  name = "github.com/gliderlabs/ssh"
  packages = ["."]
  revision = "47df570d18ad49f77cf66f76bc3fce3e92400768"

Now you need to tell dep to update the reference, and this is done using:

dep ensure -update

And that's it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment