我安装了1.7.4,然后将其解压缩到〜/ go并相应地设置GOROOT.我还创建了〜/ work/src/github.com/user/hello并相应地设置了GOPATH.
从https://golang.org/doc/install#testing尝试hello world示例时,我收到以下错误:
$ go install github.com/user/hello
../work/src/github.com/user/hello/hello.go:3:8: cannot find package "fmt" in any of:
/home/user/go/src/pkg/fmt (from $GOROOT)
/home/user/work/src/fmt (from $GOPATH)
package github.com/user/hello
imports runtime: cannot find package "runtime" in any of:
/home/user/go/src/pkg/runtime (from $GOROOT)
/home/user/work/src/runtime (from $GOPATH)
Run Code Online (Sandbox Code Playgroud)
检查〜/ go,我在〜/ go/src/fmt中找到fmt而不是〜/ go/src/pkg/fmt
感觉我错过了至关重要的事情.感谢您的帮助.