aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Meumertzheim <fabian@meumertzhe.im>2023-06-01 16:28:28 +0200
committerGitHub <noreply@github.com>2023-06-01 14:28:28 +0000
commitbd5b65eb337fc39e86d59d5fb4cedd275bf9e664 (patch)
treeaf235e017cbee3d524b5d54758d44508b9dbafaf
parentb8d560e46fd5dceb130f6a9d9d337a10f38c6b8a (diff)
downloadbazelbuild-rules_go-bd5b65eb337fc39e86d59d5fb4cedd275bf9e664.tar.gz
docs: Mention that `gazelle:prefix` can be replaced by `go.mod` (#3577)
-rw-r--r--docs/go/core/bzlmod.md9
1 files changed, 7 insertions, 2 deletions
diff --git a/docs/go/core/bzlmod.md b/docs/go/core/bzlmod.md
index 03610694..780f32d5 100644
--- a/docs/go/core/bzlmod.md
+++ b/docs/go/core/bzlmod.md
@@ -75,15 +75,20 @@ If you have a use case that would require this, please explain it in an issue.
## Generating BUILD files
-Add the following to your top-level BUILD file, including your Go module's path in a [Gazelle directive](https://github.com/bazelbuild/bazel-gazelle#directives):
+Add the following to your top-level BUILD file:
```starlark
load("@gazelle//:def.bzl", "gazelle")
-# gazelle:prefix github.com/example/project
gazelle(name = "gazelle")
```
+If there is no `go.mod` file in the same directory as your top-level BUILD file, also add the following [Gazelle directive](https://github.com/bazelbuild/bazel-gazelle#directives) to that BUILD file to supply Gazelle with your Go module's path:
+
+```starlark
+# gazelle:prefix github.com/example/project
+```
+
Then, use `bazel run //:gazelle` to (re-)generate BUILD files.
## External dependencies