> ## Documentation Index
> Fetch the complete documentation index at: https://aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# rules_go and gazelle

> Understand how Bazel supports Go through rules_go for first-party packages and gazelle for external modules and automatic BUILD file generation.

Like any language, Bazel must be taught how to work with Go. Unlike other languages however, the commonly used rules for Go are broken into two modules.

1. [https://registry.bazel.build/modules/rules\_go](https://registry.bazel.build/modules/rules_go) supports monorepo first-party packages
2. [https://registry.bazel.build/modules/gazelle](https://registry.bazel.build/modules/gazelle) adds external packages, and generates the BUILD files for them.

This split can be confusing when searching for documentation, so try to keep it in mind!

## Documentation

As of January 2025, the primary documentation for using modern Bazel (with bzlmod) is at [https://github.com/bazel-contrib/rules\_go/blob/master/docs/go/core/bzlmod.md](https://github.com/bazel-contrib/rules_go/blob/master/docs/go/core/bzlmod.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.