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
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.
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!