Last active
September 4, 2019 07:41
-
-
Save megatontech/b2610024f8852884d99b50eaeb64f38c to your computer and use it in GitHub Desktop.
国内源码安装go记录
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//从源码编译 | |
cd c:\go1.8\src\all.bat | |
//编译GO 1.6版本以上的需要依赖GO 1.4版本的二进制,并且需要把GOROOT_BOOTSTRAP的路径设置为1.4版本GO的根目录,这样它的bin目录就可以直接使用到1.4版本的GO | |
//获取1.4版本go | |
//安装go1.4需要gcc,安装mingw即可https://sourceforge.net/projects/mingw/ | |
// 选择计算机—属性---高级系统设置---环境变量,在系统变量中找到 Path 变量,在后面加入 min-gw的安装目录,如 D:\MinGw\bin | |
mingw-get install gcc | |
cd C:\Users\xxx\ | |
git clone https://github.com/golang/go.git Go1.4 | |
cd go | |
git checkout -b 1.4.3 go1.4.3 | |
//proxy | |
对于 Windows 用户,可以在 PowerShell 中设置: | |
# Enable the go modules feature | |
$env:GO111MODULE=on | |
# Set the GOPROXY environment variable | |
//包管理 | |
https://gopm.io/download | |
//IDE | |
https://sourceforge.net/projects/liteide/ | |
http://liteide.org/cn/ | |
//源码 | |
https://go.googlesource.com/go | |
//设置代理 | |
$env:GOPROXY=https://goproxy.io | |
$env:GOPROXY = "https://goproxy.io" | |
go env GOPROXY=https://goproxy.cn,direct | |
//构建godoc | |
cd C:\Go\src\golang.org\x\tools\cmd\godoc | |
go build | |
复制godoc.exe到bin | |
//启动godoc | |
godoc -http=localhost:8066 | |
在浏览器中打开http://127.0.0.1:8066 | |
//go命令 | |
go version | |
//Go的官方仓库地址: | |
https://go.googlesource.com/go | |
//Go的github的仓库地址: | |
https://github.com/golang/g | |
//Go的官网地址: | |
https://golang.org |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment