Go不是内部或外部命令

我一直在尝试设置我的Go工作空间,但它似乎不工作。每当我输入 echo %GOPATH%, 并回应 C:Users\y\GoWorkspace. 但是只要我输入 go, 就会显示 go is not recognized as an internal or external command. 这对于任何其他的Go命令都是一样的。 我使用的是Windows 8 64位版本,Go 1.2.2是32位版本。我也尝试过1.2.2 64位,但没有任何改变。

GOPATH is the path that go uses when you build or test go applications. It does not tell Windows where your go executable is. For this you have to set you path environment variable. You can also set your GOBIN environment variable.

As @JohnGilmore has pointed out the GOPATH is the location the Go tools use (executables). To set the location to the go executable so that Windows can find the command you will need to set your PATH variable.

On Windows:

SET %PATH%=%PATH%;C:\Go\bin

You can also set this so that it is in every new environment by typing 'env' into the Start->search and then choose 'Edit the system environment variables'.