go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") go_deps.archive_override(patch_strip, patches, path, sha256, strip_prefix, urls) go_deps.config(check_direct_dependencies, debug_mode, go_env) go_deps.from_file(fail_on_version_conflict, go_mod, go_work) go_deps.gazelle_override(build_extra_args, build_file_generation, directives, path) go_deps.gazelle_default_attributes(build_extra_args, build_file_generation, directives) go_deps.module(build_file_proto_mode, build_naming_convention, indirect, local_path, path, sum, version) go_deps.module_override(patch_strip, patches, path)
TAG CLASSES
Override the default source location on a given Go module in this extension.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
patch_strip | The number of leading path segments to be stripped from the file name in the patches. | Integer | optional | 0 |
patches | A list of patches to apply to the repository after gazelle runs. | List of labels | optional | [] |
path | The Go module path for the repository to be overridden. This module path must be defined by other tags in this extension within this Bazel module. |
String | required | |
sha256 | If the repository is downloaded via HTTP (urls is set), this is the SHA-256 sum of the downloaded archive. When set, Bazel will verify the archive against this sum before extracting it. |
String | optional | "" |
strip_prefix | If the repository is downloaded via HTTP (urls is set), this is a directory prefix to strip. See [http_archive.strip_prefix ]. |
String | optional | "" |
urls | A list of HTTP(S) URLs where an archive containing the project can be downloaded. Bazel will attempt to download from the first URL; the others are mirrors. | List of strings | optional | [] |
Configures the general behavior of the go_deps extension.
Only the root module's config tag is used.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
check_direct_dependencies | The way in which warnings about version mismatches for direct dependencies and Go modules that are also Bazel modules are reported. | String | optional | "" |
debug_mode | Whether or not to print stdout and stderr messages from gazelle | Boolean | optional | False |
go_env | The environment variables to use when fetching Go dependencies or running the @rules_go//go tool. |
Dictionary: String -> String | optional | {} |
Imports Go module dependencies from either a go.mod file or a go.work file.
All direct and indirect dependencies of the specified module will be imported, but only direct dependencies should
be imported into the scope of the using module via use_repo
calls. Use bazel mod tidy
to update these calls
automatically.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
fail_on_version_conflict | Fail if duplicate modules have different versions | Boolean | optional | True |
go_mod | - | Label | optional | None |
go_work | - | Label | optional | None |
Override Gazelle's behavior on a given Go module defined by other tags in this extension.
Attributes
Override Gazelle's default attribute values for all modules in this extension.
Attributes
Declare a single Go module dependency. Prefer using from_file
instead.
Attributes
Apply patches to a given Go module defined by other tags in this extension.
Attributes
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
patch_strip | The number of leading path segments to be stripped from the file name in the patches. | Integer | optional | 0 |
patches | A list of patches to apply to the repository after gazelle runs. | List of labels | optional | [] |
path | The Go module path for the repository to be overridden. This module path must be defined by other tags in this extension within this Bazel module. |
String | required |