share.png

Go 语言开发工具

Go 语言开发工具

日期:2022-07-07

本文字数:330 字 阅读完需:约 2 分钟

Go 语言开发工具


VSCode

VScode 安装教程参见:https://www.runoob.com/w3cnote/vscode-tutorial.html

然后我们打开 VSCode 的扩展(Ctrl+Shift+P):

go-vscode-1.jpeg

搜索 go:

go-vscode-2.jpeg

点击安装,安装完成后我们就可以使用代码提示、测试、调试等功能了。

completion-signature-help.gif


GoLand

GoLand 是 Jetbrains 家族的 Go 语言 IDE,有 30 天的免费试用期。

安装也很简单访问 Gogland 的下载页面,根据你当期的系统环境三大平台(Mac、Linux、Windows)下载对应的软件。

GoLand-01.jpg


LiteIDE

LiteIDE 是一款开源、跨平台的轻量级 Go 语言集成开发环境(IDE)。

支持的 操作系统

  • Windows x86 (32-bit or 64-bit)
  • Linux x86 (32-bit or 64-bit)

下载地址 :http://sourceforge.net/projects/liteide/files/

源码地址 :https://github.com/visualfc/liteide

![Image 1][]


Eclipse

Eclipse 也是非常常用的开发利器,以下介绍如何使用 Eclipse 来编写 Go 程序。

![1.4.eclipse1][Image 1]

Eclipse 编辑 Go 的主界面

  1. 首先下载并安装好 [Eclipse][]

  2. 下载 [goclipse][] 插件 [https://github.com/GoClipse/goclipse/blob/latest/documentation/Installation.md#installation][https_github.com_GoClipse_goclipse_blob_latest_documentation_Installation.md_installation]

  3. 下载 gocode,用于 go 的代码补全提示

    gocode 的 github 地址:

    1https://github.com/nsf/gocode

    在 Windows下要安装 git,通常用 [msysgit][]。

    再在 cmd 下安装:

    1go get -u github.com/nsf/gocode

    也可以下载代码,直接用 go build 来编译,会生成 gocode.exe

  4. 下载 [MinGW][] 并按要求装好

  5. 配置插件

    Windows->Reference->Go

    (1)、配置 Go 的编译器

    ![1.4.eclipse2][Image 1]

    设置 Go 的一些基础信息

    (2)、配置 Gocode(可选,代码补全),设置 Gocode 路径为之前生成的 gocode.exe 文件

    ![1.4.eclipse3][Image 1]

    设置 gocode 信息

    (3)、配置 GDB(可选,做调试用),设置 GDB 路径为 MingW 安装目录下的 gdb.exe 文件

    ![1.4.eclipse4][Image 1]

    设置 GDB 信息

  6. 测试是否成功

    新建一个 go 工程,再建立一个 hello.go。如下图:

    ![1.4.eclipse5][Image 1]

    新建项目编辑文件

    调试如下(要在 console 中用输入命令来调试):

    ![1.4.eclipse6][Image 1]

    图 1.16 调试 Go 程序

[Image 1]: [Eclipse]: http://www.eclipse.org/ [goclipse]: http://goclipse.github.io/ [https_github.com_GoClipse_goclipse_blob_latest_documentation_Installation.md_installation]: https://github.com/GoClipse/goclipse/blob/latest/documentation/Installation.md#installation [msysgit]: https://gitforwindows.org/ [MinGW]: http://sourceforge.net/projects/mingw/files/MinGW/