bazel-gazelle icon indicating copy to clipboard operation
bazel-gazelle copied to clipboard

Manual updates to the result of `update-repos`

Open srabraham opened this issue 2 years ago • 1 comments

(this is a question rather than a bug report) Hello, I have a question about the intended usage of update-repos. We have a growing monorepo full of Go code, and we'd like to make it easy for our developers to add and update Go dependencies. We're telling everyone to run bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies -prune in order to keep the list of deps up to date.

Now, we're needing to make some manual edits to particular go_repository entries, e.g. to add build_directives to them. Is it correct to modify deps.bzl manually to add those directives, knowing that we'll continue to use update-repos in the future to keep that list of go_repositories up to date? I was originally thinking that we shouldn't manually change those entries, since they were owned by update-repos, and I wouldn't want update-repos to stomp over those manual changes in the future.

So, in short, my question is about how we should think about update-repos. Is it really just there to add and remove (with -prune) go_repositories, but never to overwrite manual edits?

srabraham avatar Feb 04 '22 16:02 srabraham

This should be fine. Keep comments should prevent Gazelle from overriding manual changes to repositories.

uhthomas avatar Feb 13 '22 01:02 uhthomas