下载
https://studygolang.com/dl
go1.13.5.darwin-amd64.pkg
$go version
go version go1.9.2 darwin/amd64
A previous installation of Go exists at /usr/local/go. This installer will remove the previous installation prior to installing. Please back up any data before proceeding.
ok
$go version
go version go1.13.5 darwin/amd64
$echo $GOROOT
/usr/local/go
$export GOPROXY=https://goproxy.cn
$export GO111MODULE=on
vi ~/.bashrc
$go mod
Go mod provides access to operations on modules.
成功安装
测验
$ go get -u -v github.com/micro/go-micro
go: finding github.com/micro/go-micro v1.18.0
特别快
go:cannot find main module;see ‘go help modules’报错无法运行
$go get -d -v ./…
go: cannot find main module, but found .git/config in /Users/didi/goLang/src/github.com/golang-study-day/go-micro
to create a module there, run:
cd ../.. && go mod init
$go mod init
go: creating new go.mod: module github.com/golang-study-day/go-micro
$go get -d -v ./…
go: finding golang.org/x/net latest
go: downloading golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
go: extracting golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
cannot find package “google.golang.org/genproto/googleapis/rpc/status” in any of:
git clone https://github.com/googleapis/go-genproto