Bound retained Go command diagnostics
This commit is contained in:
@@ -11,18 +11,20 @@ errors.
|
||||
## Command output ownership
|
||||
|
||||
`Tool.Run` executes a status-only command. It forwards combined stdout and
|
||||
stderr to the optional writer while the child runs, then releases its capture
|
||||
on success. Failures include the captured diagnostic text and preserve the
|
||||
underlying process or forwarding error.
|
||||
stderr to the optional writer while the child runs, retaining only the last
|
||||
1,048,576 bytes for failure diagnostics. A truncation notice identifies omitted
|
||||
earlier bytes. Successful calls release their capture; failures preserve the
|
||||
underlying process or forwarding error. Dependency preparation uses the same
|
||||
bounded diagnostic capture.
|
||||
|
||||
`Tool.Output` returns combined stdout and stderr for commands whose output is
|
||||
needed by the caller, such as compiler identification. After the child stops,
|
||||
the capture's backing bytes transfer to the caller without a second copy. A
|
||||
failed output command returns both those bytes and an error containing the
|
||||
diagnostic text. The capture remains in memory for the duration of the child;
|
||||
the component benchmark compares one 8 MiB write with the same output in
|
||||
32 KiB writes, forwarding to `io.Discard`. Smaller writes incur buffer-growth
|
||||
allocations. The [output benchmark](../../internal/gotool/performance_test.go)
|
||||
the component benchmark compares full and bounded capture for modest output,
|
||||
one 8 MiB write, and 8 MiB in 32 KiB writes, forwarding to `io.Discard`.
|
||||
The [output benchmark](../../internal/gotool/performance_test.go)
|
||||
measures total allocated bytes per operation, excluding subprocess overhead and
|
||||
diagnostic strings. These totals count all allocations, including superseded
|
||||
buffers. The returned slice retains the final buffer holding the complete output.
|
||||
@@ -35,8 +37,8 @@ lifecycle and cleanup work and remain a follow-up option.
|
||||
Dependency preparation uses a separate command environment so proxy, private
|
||||
module, checksum, cache, and other effective settings remain available. Its
|
||||
`go mod download -modfile=` command overrides an alternate module file selected
|
||||
through `GOFLAGS`, preserving ordinary module discovery. Its completed capture
|
||||
uses the same ownership transfer when formatting a failure.
|
||||
through `GOFLAGS`, preserving ordinary module discovery. Its bounded capture
|
||||
is formatted into the error on failure.
|
||||
|
||||
## Configuration discovery
|
||||
|
||||
|
||||
Reference in New Issue
Block a user