Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "command not found" after installing go-eval

Tags:

macos

go

I'm trying to run Go in an interactive mode.

I want to use go-eval for that, I followed their README instructions:

  • I ran go get github.com/sbinet/go-eval/ successfully
  • I ran go-eval which resulted in -bash: go-eval: command not found

Some more information:

  • echo $PATH returns: /usr/local/go/bin:...

  • echo $GOPATH returns: $HOME/golang

  • running whereis go-eval returns no output

  • running go install go-eval returns:

    can't load package: package go-eval: cannot find package "go-eval" in any of: /usr/local/go/src/go-eval (from $GOROOT) $HOME/golang/src/go-eval (from $GOPATH)

like image 595
Forge Avatar asked Mar 18 '16 11:03

Forge


People also ask

How do you use Go GET command?

Go The Go Command Go Getgo get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like 'go install'. Get also accepts build flags to control the installation. When checking out a new package, get creates the target directory $GOPATH/src/<import-path> .

Where to run Go get command?

Executable is installed in the directory named by the GOBIN environment variable which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set. In this article, we will install a package using the go get command.

Where does Go get install binaries?

Much like the previous behaviour of go get , go install places binaries in $GOPATH/bin , or in $GOBIN if set.


1 Answers

You'll need to add GOPATH/bin to PATH.

PATH="$GOPATH/bin:$PATH" 

Update [Go 1.8 and above]: GOPATH will default to $HOME/go. The above will not work if GOPATH is not explicitly set.

To set both, add this to your .profile file:

export GOPATH="$HOME/go" PATH="$GOPATH/bin:$PATH" 
like image 180
user1431317 Avatar answered Sep 18 '22 14:09

user1431317