golang
1. golang安装
采用直接下载官方Linux系统golang安装包go1.16.2.linux-amd64.tar.gz
安装
$ sudo rm -rf /usr/local/go
$ sudo tar -C /usr/local -xzf go1.16.2.linux-amd64.tar.gz
$ vi ~/.profile
if [ -d "/usr/local/go/bin" ] ; then
PATH="$PATH:/usr/local/go/bin"
fi
$ source ~/.profile
$ go version
go version go1.16.2 linux/amd64
hello.go
package main
import "fmt"
func main() {
fmt.Println("hello go语言");
}
$ go build hello.go
$ ./hello
2. 学习资料
2.1 解决问题
-
无法访问proxy.golang.org的问题
$ go get rsc.io/quote go get: module rsc.io/quote: Get "https://proxy.golang.org/rsc.io/quote/@v/list": dial tcp 216.58.200.49:443: i/o timeout $ go env -w GOPROXY=https://goproxy.cn $ go get rsc.io/quote go: downloading rsc.io/quote v1.5.2 go: downloading rsc.io/sampler v1.3.0 go: downloading golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c go get: added rsc.io/quote v1.5.2