GO语言下载、安装、配置

1、Go语言下载

go语言官方下载地址:https://golang.org/dl/java

QQ图片20160224204006

找到适合你系统的版本下载,本人下载的是windows版本。也能够下载Source本身更深层次研究go语言。golang

2、GO语言安装

下载完成以后,双击go1.6.windows-amd64.msi进行安装。web

若是安装过程出现如下提示:windows

QQ图片20160224204435

以管理员的身份运行cmd,找到go1.6.windows-amd64.msi所在的目录,并输入msiexec /i go1.6.windows-amd64.msi以下图(放在D盘根目录):api

QQ图片20160224205030

步骤一:双击运行安装程序

QQ图片20160224205126

步骤二:点击Next,出现License

QQ图片20160224205243

选择I accept the terms in the License Agreeement。ide

步骤三:点击Next,选择安装路径

image

默认C:\Go\this

步骤四:点击Next进行安装

image

点击Install按钮进行安装google

image

image

步骤五:耐心等待,直到如下界面

image

点击Finish完成安装。spa

3、安装后目录说明

Go语言安装以后,C:\Go目录下一共有9个目录与9个文件,以下图:命令行

image

api — 目录,包含全部API列表,方便IDE使用

bin— 目录,存放编译后的可执行文件

blog— 目录,

doc— 目录,帮助文档

lib— 目录,

misc— 目录,

pkg— 目录,存放编译后的包文件。pkg中的文件是Go编译生成的

src— 目录,存放项目源文件

注:通常,bin和pkg目录能够不建立,go命令会自动建立(如 go install),只须要建立src目录便可。

Authors— 文件,做者列表,用记事本打开

CONTRIBUTING.md— 文件,

CONTRIBUTORS— 文件,

favicon.ico— 文件,

LICENSE— 文件,license,用记事本打开

PATENTS— 文件,

README.md— 文件,

robots.txt— 文件,使用robots.txt阻止对网址的访问,详情查看https://support.google.com/webmasters/answer/6062608?hl=zh-Hans

VERSION— 文件,版本信息,用记事本打开

4、设置GO环境变量

官方文档:

If you chose a directory other than c:\Go, you must set the GOROOT environment variable to your chosen path.

Add the bin subdirectory of your Go root (for example, c:\Go\bin) to your PATH environment variable.

Setting environment variables under Windows

Under Windows, you may set environment variables through the "Environment Variables" button on the "Advanced" tab of the "System" control panel. Some versions of Windows provide this control panel through the "Advanced System Settings" option inside the "System" control panel.

具体设置步骤以下(windows 10 企业版):

找到:个人电脑,右键,打开“属性”

image

选择“高级系统设置”

image

弹出如下对话框,选择“高级”标签:

image

点击“环境变量”按钮,弹出变量设置窗口:

image

“新建”系统变量:

image

设置变量名GOROOT,变量值C:\Go\(安装目录)

修改系统变量Path,添加C:\Go\bin\

image

环境变量设置以后,在命令行中输入go:

image

image

按回车键:

image

如查看version,运行go version

image

5、总结

Go语言安装比较简单,安装成功以后要配置运行环境变量,与java相似。

随后将继续Go语言之旅。

相关文章
相关标签/搜索