dsajkdadsa14222 2016-03-18 11:46
浏览 228
已采纳

Golang错误“找不到命令”

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

I want to use go-eval for that, I followed the 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)

  • 写回答

5条回答 默认 最新

  • doushan9415 2016-03-18 12:07
    关注

    You need to add GOPATH/bin to PATH.

    PATH="$GOPATH/bin:$PATH"
    

    Update: Starting with Go 1.8, GOPATH defaults to $HOME/go if not set. The above will not work if GOPATH is not explicitly set.

    To set both, add this to your .profile:

    export GOPATH="$HOME/go"
    PATH="$GOPATH/bin:$PATH"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?