Skip to content

Commit

Permalink
golang: allow downloads during instalation of gRPC protobuf plugins (…
Browse files Browse the repository at this point in the history
…Cherry-pick of #21614) (#21856)

As described in #21529, the Go
rules are setting `GOPROXY=off` during the invocations of `go install`
to install the gRPC protobuf plugins because that is the default for
`GoSdkProcess`. The plugin builds are failing because `GOPROXY=off`
prevents `go` from contacting the Go module proxy to learn about module
deprecations. (Unlike other uses of `GoSdkProcess`, the gRPC protobuf
plugins are relying on `go install` to do a full build of the plugin
sources, which is unlike the use of `GoSdkProcess` in the rest of the Go
backend rules.)

Solution: Set `allow_downloads=True` (which is already done for a
preceding `go mod download`) to allow `go` to contact the Go module
proxy as needed by not setting `GOPROXY=off`.

Fixes #21529.

Co-authored-by: Tom Dyas <[email protected]>
  • Loading branch information
WorkerPants and tdyas authored Jan 19, 2025
1 parent 3b89c87 commit b9ff433
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/python/pants/backend/codegen/protobuf/go/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ async def setup_go_protoc_plugin() -> _SetupGoProtocPlugin:
input_digest=download_sources_result.output_digest,
output_files=["gopath/bin/protoc-gen-go"],
description="Build Go protobuf plugin for `protoc`.",
# Allow `go` to contact the Go module proxy since it will run its own build.
allow_downloads=True,
),
),
Get(
Expand All @@ -611,6 +613,8 @@ async def setup_go_protoc_plugin() -> _SetupGoProtocPlugin:
input_digest=download_sources_result.output_digest,
output_files=["gopath/bin/protoc-gen-go-grpc"],
description="Build Go gRPC protobuf plugin for `protoc`.",
# Allow `go` to contact the Go module proxy since it will run its own build.
allow_downloads=True,
),
),
)
Expand Down

0 comments on commit b9ff433

Please sign in to comment.