Error “command not found” after installing go-eval

前端 未结 5 702
醉梦人生
醉梦人生 2020-12-09 08:56

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
5条回答
  •  自闭症患者
    2020-12-09 09:44

    Is the binary go-eval in $GOPATH/bin? Are you running the command with $GOPATH/bin/ as your working directory? If not, thats likely the problem.

    go get & go install installs go binaries (if any) in $GOPATH/bin

    Check $GOPATH/bin for the go-eval binary. If its there, try running it from $GOPATH/bin with ./go-eval. If that works, you're good.

    In future, if you wish to run go binaries found in $GOPATH/bin from anywhere in your shell, add the following to your .bashrc or profile:

    export PATH=$PATH:$GOPATH/bin

    Then restart your terminal or run . ~/.bashrc or . /etc/profile

    When running go install go-eval I get:

    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)

    You get the above error because go-eval is not in $HOME/golang/src/go-eval. Running go get github.com/sbinet/go-eval/ will download the source to $GOPATH/src/github/sbinet/go-eval/. If you want to run go install go-eval, you have to specify the package name relevant to its position in the directory hierarchy in $GOPATH/src.

    e.g. go install github/sbinet/go-eval

提交回复
热议问题