Error "command not found" after installing go-eval

Issue

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)

Solution

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"

Answered By – user1431317

Answer Checked By – Gilberto Lyons (GoLangFix Admin)

Leave a Reply

Your email address will not be published.