英文:
Modify underlying Go sub dependency on the package I am using
问题
我在尝试更新我的依赖项时,通过go mod tidy
命令遇到了这个错误。我主要正在开发一个用于与cert-manager一起使用的webhook服务,但我无法解决这个依赖问题,因为我所依赖的包是由其他开发人员创建的,我无法控制这些“子依赖项”。
这是我的输出:
go.opentelemetry.io/otel/semconv: 找到模块 go.opentelemetry.io/otel@latest (v1.9.0),但不包含包 go.opentelemetry.io/otel/semconv
我在这里查找了该包:https://pkg.go.dev/go.opentelemetry.io/otel/semconv
对我来说,问题似乎是该包已经被重构为以下形式:
go.opentelemetry.io/otel/semconv/v1.9.0
作为子目录而不是包版本。
有没有办法我可以操纵我服务所依赖的包的底层依赖关系?
如果您需要更多信息,请留下评论。
请查看已接受解决方案的评论。
英文:
I am getting this error from go mod tidy
when I am trying to update my dependancies. I am primarily developing a webhook service to use with cert-manager and I cannot figure out how to resolve this dependency isssue since the packages I am dependent on are created by other developers and I cannot control those "sub dependency".
This is my output:
go.opentelemetry.io/otel/semconv: module go.opentelemetry.io/otel@latest found (v1.9.0), but does not contain package go.opentelemetry.io/otel/semconv
I looked the package up here: https://pkg.go.dev/go.opentelemetry.io/otel/semconv
and the problem for me seems like that the package have been restructured like this:
go.opentelemetry.io/otel/semconv/v1.9.0
as a subdirectory instead of package version.
Is there a way I can manipulate the underlying dependancy of the packages that my service is depending on?
Please leave a comment if you need addictional information.
Take a look at the accepted solution's comments
答案1
得分: 2
你可能想使用本地副本的模块,这样你就可以修复问题并使用它。以下是操作步骤:
- 克隆模块存储库:git clone https://github.com/open-telemetry/opentelemetry-go.git
- 如果需要,切换到一个分支/标签:git checkout branch_name
- 在你的模块的 go.mod 文件中,添加以下行:
replace (
go.opentelemetry.io => /path/where/cloned/opentelemetry-go
)
- 现在,你应该能够修改克隆的
opentelemetry-go
存储库中的代码,并在你的模块中使用它。
英文:
You may want to use a local copy of the module where you can fix the issue and use it. Steps for that
- Clone the module repository git clone https://github.com/open-telemetry/opentelemetry-go.git
- If needed, checkout to a branch/tag git checkout branch_name
- In the go.mod file of your module, add the following lines
replace (
go.opentelemetry.io => /path/where/cloned/opentelemetry-go
)
- Now you should be able to modify code in the cloned
opentelemetry-go
repo and use it in your module
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论