1. 安装部署
1.1 Windows 平台
1.1.1 设置环境变量
set GOROOT=C:\Softwares\Go # 安装路径
set GOPATH=D:\Workspace\Go # 工作目录,可以设置多个路径
set GOBIN=%GOROOT%\bin # 编译路径,用于存放编译生成的可执行文件,不允许设置多个路径。缺省时,可执行文件存放到当前工作目录中。
set PATH=%PATH%;%GOROOT%\bin;%GOPATH%\bin # 全局搜索路径
Go 提供 go env -w
命令配置环境变量,配置信息存储在 %USERPROFILE%\AppData\Roaming\go\env
文件中,该方法对系统的侵入性较小。
go env -w GO111MODULE=on # 全局使用 GoProxy 替代 GOPATH
go env -w GOPROXY=https://goproxy.io,direct # 设置 GoProxy 镜像代理
1.1.2 安装第三方包
go get -u -v golang.org/x/lint/golint
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/go-delve/delve/cmd/dlv
go get -u -v github.com/lukehoban/go-outline
go get -u -v github.com/newhook/go-symbols
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/sqs/goreturns
go get -u -v github.com/nsf/gocode
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/josharian/impl
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/alecthomas/gometalinter
gometalinter --install
go get -u -v github.com/hyperledger/fabric/cmd/...
go get -u -v github.com/ethereum/go-ethereum/cmd/...