官方下载安装页面
https://golang.org/doc/install
git主页
https://github.com/golang/go
相关下载地址
https://golang.org/dl/
linux版本 (Linux 2.6.23 or later, Intel 64-bit processor)
https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
windows版本(Windows 7 or later, Intel 64-bit processor)
https://dl.google.com/go/go1.12.5.windows-amd64.msi
源码
https://dl.google.com/go/go1.12.5.src.tar.gz
centos7下载linux版本的
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gzsudo tar -C /usr/local/ -xzf go1.12.5.linux-amd64.tar.gzecho 'export PATH=$PATH:/usr/local/go/bin' >>/etc/bashrcexport PATH=$PATH:/usr/local/go/bin
测试安装是否成功
cd ~/
vim hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
go run hello.gogo build hello.go
ls -ls
124940 -rw-rw-r--. 1 centos centos 127938445 May 7 01:32 go1.12.5.linux-amd64.tar.gz
1964 -rwxr-xr-x. 1 root root 2010039 May 27 06:13 hello
4 -rw-r--r--. 1 root root 74 May 27 06:08 hello.go
windows的安装
下载msi安装包
设置环境变量 (需确认.如果没有就新建)
alt鼠标左键 双击高级设置环境变量c:\Go\bin
测试安装
hello.go
package main
import "fmt"
func main() {
fmt.Printf("hello, world\n")
}
WINrenter
C:\Users\makeit>go run hello.go
hello, world
C:\Users\makeit>go build hello.go
C:\Users\makeit>hello
hello, world
ok.