英文:
Run Gazelle in dry-run or warn mode
问题
上下文
有没有一种方法可以让gazelle以干运行模式运行?
我想创建一个CI作业,以干运行模式运行gazelle,并在gazelle发现任何更改时失败。
类似于这样的命令
$ bazel run //:gazelle --dry-run || exit 1
不同的方法
我认为可以通过运行该命令并查看git是否发现任何更改来实现,但我更喜欢一种非git的方法。
英文:
Context
Is there a way to have gazelle run in dry-run mode?
I'd like to create a CI job that runs gazelle with dry-run and fails if gazelle finds any changes.
Something like this
$ bazel run //:gazelle --dry-run || exit 1
Different Approach
I think this can be accomplished by running the command and seeing if git finds any changes, but I would prefer a non-git approach.
答案1
得分: 1
"-mode diff"标志在以"update"模式(默认模式)运行时应该能够完美工作:
https://github.com/bazelbuild/bazel-gazelle#fix-and-update
$ bazel run //:gazelle -- -mode diff || exit 1
我正在努力创建一个bazel测试,以强制执行这个操作,如果成功了,我会分享给你!
英文:
The -mode diff
flag should work perfectly here when running in update
mode (the default):
https://github.com/bazelbuild/bazel-gazelle#fix-and-update
$ bazel run //:gazelle -- -mode diff || exit 1
I'm working on making a bazel test that would enforce this, will share if/when I get something working!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论