go语言官方下载地址:https://golang.org/dl/java
找到适合你系统的版本下载,本人下载的是windows版本。也能够下载Source本身更深层次研究go语言。golang
下载完成以后,双击go1.6.windows-amd64.msi进行安装。web
若是安装过程出现如下提示:windows
以管理员的身份运行cmd,找到go1.6.windows-amd64.msi所在的目录,并输入msiexec /i go1.6.windows-amd64.msi以下图(放在D盘根目录):api
选择I accept the terms in the License Agreeement。ide
默认C:\Go\this
点击Install按钮进行安装google
点击Finish完成安装。spa
Go语言安装以后,C:\Go目录下一共有9个目录与9个文件,以下图:命令行
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— 文件,版本信息,用记事本打开
官方文档:
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.
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 企业版):
找到:个人电脑,右键,打开“属性”
选择“高级系统设置”
弹出如下对话框,选择“高级”标签:
点击“环境变量”按钮,弹出变量设置窗口:
“新建”系统变量:
设置变量名GOROOT,变量值C:\Go\(安装目录)
修改系统变量Path,添加C:\Go\bin\
环境变量设置以后,在命令行中输入go:
按回车键:
如查看version,运行go version
Go语言安装比较简单,安装成功以后要配置运行环境变量,与java相似。
随后将继续Go语言之旅。