v0.32.0
Starting this release, Gazelle no longer resolves Go and proto imports of Google APIs to @go_googleapis
. Instead, Go packages from Google APIs will be treated as regular Go packages, and resolve to @org_golang_google_genproto
, which contains the pre-generated Go code, with its version determined by Go modules. For proto files importing Google APIs proto and generating Go code, users need to:
- Add an
http_archive
rule to download Google APIs, e.g.,
http_archive(
name = "googleapis",
sha256 = "9d1a930e767c93c825398b8f8692eca3fe353b9aaadedfbcf1fca2282c85df88",
strip_prefix = "googleapis-64926d52febbf298cb82a8f472ade4a3969ba922",
urls = [
"https://github.com/googleapis/googleapis/archive/64926d52febbf298cb82a8f472ade4a3969ba922.zip",
],
)
load("@googleapis//:repository_rules.bzl", "switched_rules_by_language")
switched_rules_by_language(
name = "com_google_googleapis_imports",
)
Note that the version of Google APIs archive needs to be compatible with the pre-generated code in @org_golang_google_genproto
.
- Resolve the proto manually. If Gazelle is being used, directives like the following need to be added to a parent directory of the proto files:
# gazelle:resolve proto proto google/rpc/status.proto @googleapis//google/rpc:status_proto
# gazelle:resolve proto go google/rpc/status.proto @org_golang_google_genproto//googleapis/rpc/status
# gazelle:resolve proto google/longrunning/operations.proto @googleapis//google/longrunning:operations_proto
# gazelle:resolve proto go google/longrunning/operations.proto @org_golang_google_genproto//googleapis/longrunning
What's Changed
- Decouple Google APIs by @linzhp in #1561
- resolve: Add a resolve_regexp directive by @DolceTriade in #1542
- Remove module dependency on go_googleapis by @linzhp in #1563
- Testing on macOS arm64 by @linzhp in #1568
- Stop resolving to @io_bazel_rules_go//proto/wkt by @linzhp in #1567
- Fix directive table in Readme file by @farhaven in #1571
New Contributors
- @DolceTriade made their first contribution in #1542
- @farhaven made their first contribution in #1571
Full Changelog: v0.31.1...v0.32.0