Go get dependencies of current branch/tag

I was hoping to checkout a branch or tag on a Go repo, then run go get -u to get its dependencies. But to my dismay, this switched the repository back to master first.

Is there a good way to go get all the dependencies of the current branch or tag? It’s OK if the dependencies are pulled down from master like usual, just don’t want to change the current repo.

go get without the -u works like you want.

Ding ding ding! That’ll do - thanks!

1 Like

Be aware that ‘go get’ will only download the any missing dependencies, if a dependency has been updated but is already in your go path then the dependency will not be updated, from the docs:

The -u flag instructs get to use the network to update the named packages
and their dependencies.  By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.