目录说明:
GOROOT 就是安装的路径,默认安装就是c:\Go
PATH 需要追加 安装下面的bin目录,C:\Go\bin
GOPATH 这个估计是相当于是eclipse的workspace,根据自己喜好设定在一个文件中。
src 放源码,
pkg(我暂时还不清楚)
扫描二维码关注公众号,回复:
408197 查看本文章
bin 存放编译后的结果
配置eclipse 代码提示功能
从 https://github.com/nsf/gocode 下载源码 解压
进入解压目录 执行 go build 生成 gocode.exe 把eclipse gocode指向生成的gocode.exe
配置eclipse debug
下载 mingw64
https://nchc.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z
直接解压 eclipse 指向加压 gdb.exe 即可
错误集合:
1. eclipse运行go文件,报错“Resource donesnt have a corresponding Go paceage.”
解决:src目录下需要一个main包
2.import cycle not allowed
golang不允许循环导包,如果检测到import cycle,会在编译时报错,通常import cycle是因为设计错误或包的规划问题