usage: replace module/path [v1.2.3] => other/module v1.4
or replace module/path [v1.2.3] => ../local/directory
目录结构
- model
- user.go
- manage-api
- main.go
model 包目录
- 根目录执行
go mod init model
manage-api 包目录
- go.mod 修改
require gitee.com/xxx/model v0.0.0
replace gitee.com/xxx/model => ../model
- 代码引用
import (
"gitee.com/xxx/model"
)
设置环境变量允许绕过所选模块的代理
go env -w GOPRIVATE=*.corp.example.com
网友评论