安装包下载地址:

选择windows的包名并下载
Windows 下可以使用 . msi 后缀的包名,下载之后直接运行安装,安装路径就使用它默认的 C:\Go\ 即可(之后添加 环境变量 就简单),之后一路 Next 并完成安装。

2.Go 语言环境变量设置
2.1 光标指向win图标,鼠标右键–》选择控制面板

2.2选择系统与安全

2.3选择系统

2.4 选择高级系统设置

2.5点击高级,选择环境变量

第一步安装使用的是默认安装目录 C:\Go\,那么安装程序就已经将 GOROOT 和 Path 两个环境变量设置好了,无须再对其进行手工设置。


2.6 Go 工作目录 GOPATH
以后的文件都可以放到这个目录下

创建 hello.go 文件并编辑其内容如下:
package main import "fmt" func main() { fmt.Printf("hello, world\n") }
保存后,从cmd进入该目录,并执行 go run hello.go:

输出”hello,world”,证明我们的go安装成功。
