Skip to content

Commit

Permalink
docs: Mention that gazelle:prefix can be replaced by go.mod (#3577)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored Jun 1, 2023
1 parent b8d560e commit bd5b65e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions docs/go/core/bzlmod.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd5b65e

Please sign in to comment.