]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: introduce Shell abstraction
authorAustin Clements <austin@google.com>
Wed, 20 Sep 2023 21:01:40 +0000 (17:01 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 19 Oct 2023 19:09:38 +0000 (19:09 +0000)
commit4c31dfe850165979bbcf0510c35576d022f26eb3
treee0236c25d6822766ab5f55bd521d136f3d59636c
parenteabf3bf6887a16c33ba6039d2ed98ff8f261de96
cmd/go: introduce Shell abstraction

This CL separates running shell commands and doing shell-like
operations out of the Builder type and into their own, new Shell type.
Shell is responsible for tracking output streams and the Action that's
running commands. Shells form a tree somewhat like Context, where new
Shells can be derived from a root shell to adjust their state.

The primary intent is to support "go build -json", where we need to
flow the current package ID down to the lowest level of command output
printing. Shell gives us a way to easily flow that context down.

However, this also puts a clear boundary around how we run commands,
removing this from the rather large Builder abstraction.

For #62067.

Change-Id: Ia9ab2a2d7cac0269ca627bbb316dbd9610bcda44
Reviewed-on: https://go-review.googlesource.com/c/go/+/535016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Austin Clements <austin@google.com>
src/cmd/go/internal/clean/clean.go
src/cmd/go/internal/run/run.go
src/cmd/go/internal/test/test.go
src/cmd/go/internal/work/action.go
src/cmd/go/internal/work/build_test.go
src/cmd/go/internal/work/buildid.go
src/cmd/go/internal/work/cover.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/gccgo.go
src/cmd/go/internal/work/shell.go [new file with mode: 0644]