英文:
is there a way to update go packages and ignore errors?
问题
以下是翻译好的内容:
这是情景:
- 在包
myPackage中,我进行了一个破坏性的改变。别担心,它是私有的,没有人在意。 - 在项目
myProject中,我想使用新的myPackage版本。 - 在
myProject中运行go get -u ./...不会更新包,因为go会发现错误(由于破坏性的改变)。
我可以理解这是一个好主意,但在这种情况下,我希望go强制更新,打破一切,这样我就可以跟随编译器错误,直到我的代码最终准备好。
有没有办法实现这一点?
英文:
Here's the scenario:
- in package
myPackageI make a breaking change. No worries, it's private, nobody cares - in project
myProjectI would like to use the newmyPackageversion. - running
go get -u ./...inmyProjectwill not update the package, since go will find errors (due to the breaking changes).
I can see how this is a good idea, but in this very case I would like go to force the update, break everything, so I can follow the compiler errors until my code is finally ready.
Is there any way to achieve this ?
答案1
得分: 2
-d 标志会导致 go get 下载所请求的包,但不会构建它们。(从 Go 1.18 开始,-d 标志计划成为 go get 的默认行为,详情请参考 这里。)
go get -d -u ./... 应该会执行你想要的更新操作。
英文:
The -d flag causes go get to download the requested packages but not build them. (The -d flag is planned to be the default behavior of go get starting with Go 1.18.)
go get -d -u ./... should perform the update you intend.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论