我在我的库 golang 中进行了本地更改,在推送到 github 存储库之前我必须先测试这些更改,我的想法是从另一个服务模块进行测试并调用库来使用这些方法。我能做到这一点吗?
2 回答

幕布斯6054654
TA贡献1876条经验 获得超7个赞
响应令人困惑,为了澄清这一点,我希望更好地记录我的解决方案:
在 go.mod 文件中,我必须使用本地开发而不是存储库 github.com/../../..
我们有一个步骤,简单地说,写替换 <github.com/repository> => myLocalFolder
例子:
//go.mod
require (
//this is a repository that I want change
github.com/example/my-reposiory v1.2.0
)
//这里写replace,实现使用本地代码代替仓库代码
replace github.com/avaldigitallabs/adl-habilitadora-lib-go-shared-kernel => /Users/<my_user>/Documents/Projects/my_local_folder
//go.mod 完整示例:
module my-module
go 1.14
require (
github.com/example/my-reposiory v1.2.0
)
replace github.com/example/my-reposiory => /Users/<my_user>/Documents/Projects/my_local_folder
- 2 回答
- 0 关注
- 111 浏览
添加回答
举报
0/150
提交
取消