Unable to Install Go Dep

I am trying to run the command dep ensure on my Ubuntu 16.04, but the system is unable to find the command. When I run sudo apt install dep or any other installation commands, I always get this error when I run dep ensure:

No command 'dep' found, did you mean:
 Command 'dp' from package 'speech-tools' (universe)
 Command 'iep' from package 'emboss' (universe)
 Command 'dwp' from package 'binutils' (main)
 Command 'dex' from package 'dex' (universe)
 Command 'rep' from package 'rep' (universe)
 Command 'delp' from package 'fp-utils-3.0.0' (universe)
 Command 'xep' from package 'pvm-examples' (universe)
dep: command not found

Someone tells me I need Ubuntu 18 to run dep, but I would like to know how I can install this on my current Ubuntu. Thanks.

3 Answers

To see if a package is available in the repo's you use, type apt-cache search dep or apt-cache search go-dep.

Go dep is not available in the 16.04 repo's. It is available in the 18.04 repo's, so 'someone' was (at least partially) right.

Maybe you can install it from Github?

3

Install and usage of go-dep on Ubuntu 16.04:

Create bin directory inside $GOPATH

cd $GOPATH
mkdir bin

Now download the compiled dep file.

curl  | sh

Copy the dep file from $GOPATH/go/bin to the project's root location.

Execute the dep file with commands

./dep [command]

dep commands:

Usage: "dep [command]"

Commands:

  init     Set up a new Go project, or migrate an existing one
  status   Report the status of the project's dependencies
  ensure   Ensure a dependency is safely vendored in the project
  version  Show the dep version information
  check    Check if imports, Gopkg.toml, and Gopkg.lock are in sync

Examples:
  dep init                               set up a new project
  dep ensure                             install the project's dependencies
  dep ensure -update                     update the locked versions of all dependencies
  dep ensure -add   add a dependency to the project

Use "dep help [command]" for more information about a command.
1

You can have it in your PATH

curl -LO 
chmod 700 install.sh
./install.sh
chmod +x $GOPATH/bin/dep
sudo mv $GOPATH/bin/dep /usr/local/bin/

so you can call it from everywhere dep

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest