Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

安装环境,配置环境变量

GOROOT:go安装路径
GOPATH: 项目目录
PATH :%GOROOT%\bin;%GOPATH%\bin

GOland 配置环境

https://github.com/goproxyio/goproxy go env -w GO111MODULE=on go env -w GOPROXY=https://goproxy.io,direct

# 设置不走 proxy 的私有仓库,多个用逗号相隔(可选)
go env -w GOPRIVATE=*.corp.example.com

# 设置不走 proxy 的私有组织(可选)
go env -w GOPRIVATE=example.com/org_name

go moudle 初始化

go mod project_name
go build

go mod 引用本地项目

  • go mod edit -replace 项目名称=项目路径
go mod edit -replace testttt=/home/small/gopath/src/testttt