sublime3下执行go run main.go报如下错误:
main.go:9:5: cannot find package "server/rest" in any of:
/usr/local/go/src/server/rest (from $GOROOT)
/Users/runc/code/golang/src/server/rest (from $GOPATH)
exit status 1
本机环境:
runc:rest > echo $GOROOT
/usr/local/go
runc:rest > echo $GOPATH
/Users/runc/code/golang
项目当前目录:
runc:rest > pwd
/Users/runc/code/golang/src/rest
runc:rest >
求解答!
更多评论
不要直接`go run main.go`, 这会只编译运行`main.go`这一个文件,在目录下运行`go build`, 再运行生成的二进制文件
#1