Go语言Eclipse开发环境配置-Windows

时间:2023-03-09 19:36:25
Go语言Eclipse开发环境配置-Windows

1.首先安装eclipse,选择一个适合的版本就好,解压即可

http://www.eclipse.org/downloads/

Go语言Eclipse开发环境配置-Windows

2.下载go语言安装包

官网地址 :http://www.golang.org/

官网地址有时候打不开,百度云盘下载go1.2安装包  http://pan.baidu.com/s/1c0Gf4UO#dir/path=%2FSoft%2FGoLang  32 64位都有

Go语言Eclipse开发环境配置-Windows一路Next

Go语言Eclipse开发环境配置-Windows

cmd输入go version 看到这个就安装好了,环境变量什么的会自动配置好的,唯一需要配的一个GOPATH建议配置一下,用于工作空间

Go语言Eclipse开发环境配置-Windows

注意GOPATH文件夹的目录结构如下图,后续go get 的时候会用上

Go语言Eclipse开发环境配置-Windows

3.打开eclipse安装goclipse

Go语言Eclipse开发环境配置-Windows

输入goclipse的地址  http://goclipse.googlecode.com/svn/trunk/goclipse-update-site/

Go语言Eclipse开发环境配置-Windows

4. 重启下eclipse ,点开Window-preferences 确认下图的内容

Go语言Eclipse开发环境配置-Windows

Debugger       - 调试go的代码

Gocode          -代码补全

下载地址  http://pan.baidu.com/disk/home#dir/path=%2FSoft%2FGoLang  这里也有下载下来配置下就可以了

5. helloworld 程序, File->New->Go Project

Go语言Eclipse开发环境配置-Windows

go的代码必须写在src里,且程序入口必须在package main 里的main 方法,否则可能会出错,ctrl+F11运行

运行之后bin文件夹里会自动生成一个exe

Go语言Eclipse开发环境配置-Windows

6. window 7下 Eclipse 中文字体很小的问题,如下图

Go语言Eclipse开发环境配置-Windows

解决办法

5.1  下载微软雅黑混合字体    http://pan.baidu.com/s/1c0Gf4UO#dir/path=%2FSoft%2FGoLang   YaHei.Consolas.1.12.ttf

5.2  复制字体到 C:\Windows\Fonts 目录下

5.3  打开Eclipse,点开Windows->Preferences->Genneral->Appearance->Colors and Font->展开右边的Basic->双击 "Text Font" ->选择YaHei Consolas Hybrid->确定

Go语言Eclipse开发环境配置-Windows

-结束  开启你的golang之程吧