From 1724380277e559d3757c1a012cd46a7e8c2c847f Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 6 Apr 2023 15:28:24 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Steven E. Harris --- docs/go/core/bzlmod.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/go/core/bzlmod.md b/docs/go/core/bzlmod.md index b3a00ffee9..ee209d9d3d 100644 --- a/docs/go/core/bzlmod.md +++ b/docs/go/core/bzlmod.md @@ -1,7 +1,7 @@ # Go with Bzlmod This document describes how to use rules_go and Gazelle with Bazel's new external dependency subsystem [Bzlmod](https://bazel.build/external/overview#bzlmod), which is meant to replace `WORKSPACE` files eventually. -Usages of rules_go and Gazelle in `BUILD` files are not affected by this, refer to the existing documentation on rules and configuration options for them. +Usages of rules_go and Gazelle in `BUILD` files are not affected by this; refer to the existing documentation on rules and configuration options for them. ## Setup @@ -33,7 +33,7 @@ go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") # Download an SDK for the host OS & architecture. go_sdk.download(version = "1.20.3") -# Download an SDK for a fixed OS/architecture, e.g. for remote execution. +# Alternately, download an SDK for a fixed OS/architecture, e.g. for remote execution. go_sdk.download( version = "1.20.3", goarch = "amd64", @@ -44,7 +44,7 @@ go_sdk.download( go_sdk.host() ``` -Multiple Go SDKs can be registered and selected on a per-target basis using [`go_cross_binary`](rules.md#go_cross_binary). +You can register multiple Go SDKs and select which one to use on a per-target basis using [`go_cross_binary`](rules.md#go_cross_binary). The usual rules of [toolchain resolution](https://bazel.build/extending/toolchains#toolchain-resolution) apply, with SDKs registered in the root module taking precedence over those registered in dependencies. ### Using a Go SDK @@ -95,7 +95,7 @@ For every major version of a Go module, there will only ever be a single version ### Specifying external dependencies Even though this is not a strict requirement, for interoperability with Go tooling that isn't Bazel-aware, it is recommended to manage Go dependencies via `go.mod`. -The `go_deps` extension can directly parse this file, so external tooling such as `gazelle update-repos` is no longer needed. +The `go_deps` extension parses this file directly, so external tooling such as `gazelle update-repos` is no longer needed. Register the `go.mod` file with the `go_deps` extension as follows: @@ -116,7 +116,7 @@ use_repo( There is [ongoing work](https://github.com/bazelbuild/bazel/issues/17908) targeted for Bazel 6.2.0 to automate the generation of the `use_repo` statement. Alternatively, you can specify a module extension tag to add an individual dependency. -This can for example be useful for dependencies of generated code that `go mod tidy` would remove (there is [ongoing work](https://github.com/bazelbuild/bazel-gazelle/pull/1495) to provide a Bazel-aware version of `tidy`). +This can be useful for dependencies of generated code that `go mod tidy` would remove. (There is [ongoing work](https://github.com/bazelbuild/bazel-gazelle/pull/1495) to provide a Bazel-aware version of `tidy`.) ```starlark go_deps.module(