Skip to content

Commit

Permalink
docs: Mention that gazelle:prefix can be replaced by go.mod (baze…
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum authored and jacqueline.lee committed Jul 19, 2023
1 parent c9a4c05 commit e5e685c
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 e5e685c

Please sign in to comment.