From e5e685c84324731247e3525478e9fe07b17a4344 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 1 Jun 2023 16:28:28 +0200 Subject: [PATCH] docs: Mention that `gazelle:prefix` can be replaced by `go.mod` (#3577) --- docs/go/core/bzlmod.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/go/core/bzlmod.md b/docs/go/core/bzlmod.md index 036106947f..780f32d5c5 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