Changes
- Gazelle can now import dependencies from go.mod files into WORKSPACE with
gazelle update-repos -from_file=go.mod
. This includes transitive dependencies not explicitly mentioned in go.mod. - cmd/autogazelle - an experimental new tool for running Gazelle as part of each Bazel command. See the README for details.
- New directives:
# gazelle:follow symlink
- follow a specific symlink to a directory. Gazelle normally ignores symbolic links to directories within a repository to avoid visiting a directory on more than one path. When using this, take care to# gazelle:exclude
the directory from its actual parent to prevent this from happening.# gazelle:resolve source-lang import-lang import-string label
- specifies an explicit mapping from an import string to a label for dependency resolution.
- New command-line options:
-r=true
- controls whether Gazelle updates build files recursively in directories mentioned on the command line. True by default.-index=true
- controls whether Gazelle indexes library rules in the repository and uses the index to resolve imports to Bazel labels. True by default.
- The
go_repository
rule now accepts patches and commands in the same format asgit_repository
andhttp_archive
from@bazel_tools
. Patches are applied after Gazelle is run (if it is run). - The
fix
andupdate
commands can write patch files with-mode=patch
. - The
gazelle
rule can now append to the command line argument list (instead of replacing it) if the arguments are prefixed with-args
. For example,bazel run //:gazelle -- -args -index=false -r=false internal/label
. - The
gazelle
rule now works on Windows.