[GO] mac cannot find package "fmt"
2017-08-05 23:01
495 查看
报错:
原因:设置的GOROOT出现了错误。
GOROOT就是go的安装目录,而不是go bin的目录,默认给的就是这个目录,而在mac下使用brew安装的目录不是这个导致出现了错误,brew go的安装bin目录为:
/usr/local/Cellar/go/1.8.3/libexec/bin/go
此处使用: /usr/local/Cellar/go/1.8.3/libexec即可,如下:
可以继续玩耍了。
/usr/local/Cellar/go/1.8.3/libexec/bin/go build -i [/Users/xxxx] httpServer.go:5:2: cannot find package "fmt" in any of: /usr/local/bin/src/fmt (from $GOROOT) /Users/haiqingzhu/go/src/fmt (from $GOPATH) httpServer.go:6:2: cannot find package "log" in any of: /usr/local/bin/src/log (from $GOROOT) /Users/haiqingzhu/go/src/log (from $GOPATH)
原因:设置的GOROOT出现了错误。
GOROOT就是go的安装目录,而不是go bin的目录,默认给的就是这个目录,而在mac下使用brew安装的目录不是这个导致出现了错误,brew go的安装bin目录为:
/usr/local/Cellar/go/1.8.3/libexec/bin/go
此处使用: /usr/local/Cellar/go/1.8.3/libexec即可,如下:
可以继续玩耍了。
相关文章推荐
- cannot find package "golang.org/x/net/proxy"
- Fix cannot find package "golang.org/x/net/context"
- Fix cannot find package "golang.org/x/net/context"
- Fix cannot find package "golang.org/x/text/unicode/norm"
- cannot find package "golang.org/x/text/..." 或者"golang.org/x/net/..."的解决方法
- cannot find package "github.com/as/structslice"
- Go error--cannot find package
- Windows7下装VS2008后程序调用windows.h出现cannot find "widows.h" file解决方法
- cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
- python import module -- cannot find reference "XXX" in __init.py__
- OPAM failed to install CIL because computer cannot find package Ocamlfind
- Cannot find `include file "timescale.v" in directories
- [Nginx学习]nginx: [error] OpenEvent("Global\ngx_reload_5988") failed (2: The system cannot find the fi
- xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
- 【Jstl】java cannot find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
- go:cannot find GOROOT directory c:\go
- 关于vs2013 安装后出现"Cannot find one of more components. Please reinstall the application"处理方法
- liteide go: cannot find GOROOT directory:错误解决
- 解决Mac OS lion下(ubuntu等linux也一样)启动tomcat的Cannot find ./catalina.sh 的问题
- nyar4psg: Cannot find a class or type named "MultiMarker"