配置環境變量
export GO111MODULE=on
export GOPROXY=https://mirrors.aliyun.com/goproxy/
初始化
#項目在go path中
go mod init
#項目不在go path中
go mod init <項目名>
下載依賴
go mod tidy
保存到vendor
go mod vendor
編譯時使用vendor
go build -mod=vendor