Go新手:如何运行goroutines shell?

I tried running shell-basic but nothing happens. Here is what I tried:

To run this example, download and install it with go get:

go get goroutines.com/shell-basic

which finishes silently and I see it downloaded the shell basic script but when i execute shell-basic i get:

$ shell-basic
-bash: shell-basic: command not found

did I do something wrong, or am i missing something?

what i'm interested in is running go as scripts..

go get will fetch the source and put it in your Go path, try echo $GOPATH in the shell. This is what happens if go get finishes silently.

Then you want to go to that source:

cd $GOPATH/src/goroutines.com/shell-basic

aftwards, you must run go install inside the repo. (or you can run go install /path/to/the/code.

The source will then be put in $GOPATH/bin, and be executable.

Of course none of this will work if you don't have you GOPATH set up.

I think you not set GOBIN.

You can follow:

export PATH=$PATH:$GOPATH/bin

Or, try run $GOPATH/bin/shell-basic.Use your gopath replace $GOPATH.