Go

2019-09-11

WSL2编译inlets过程

1.安装go

apt install golang-go

2.配置go代理

echo "export GO111MODULE=on" >> ~/.profile
echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
source ~/.profile

3.下载安装源码

go get -u github.com/inlets/inlets-archived
cd $GOPATH/src/github.com/inlets/inlets-archived

4.开始编译

Linux:

go build

windows:

CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build

快速安装

windows

在官网直接下载msi文件安装即可:https://golang.org/dl/

ubuntu

如果您使用的是Ubuntu 16.04 LTS,18.04 LTS或19.04,那么您可以使用longsleep/golang-backportsPPA并安装Go 1.13。

add-apt-repository ppa:longsleep/golang-backports
apt-get update
apt-get install golang-go

国内不能go get处理办法

推荐使用七牛团队发布的代理模块:https://github.com/goproxy/goproxy.cn

其他代理模块

https://github.com/golang/go/wiki/Modules#are-there-always-on-module-repositories-and-enterprise-proxies

GO在线教程:https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/preface.md