buildprogress

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package buildprogress reports product-neutral diagnostics for explicit builds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CombinedOutput

func CombinedOutput(ctx context.Context, cmd *exec.Cmd) ([]byte, error)

CombinedOutput preserves the compiler diagnostics used by build failure classification while streaming them to the selected observer.

func Enabled

func Enabled(ctx context.Context) bool

Enabled reports whether this operation has a progress observer.

func Member

func Member(ctx context.Context, name string) context.Context

Member labels toolchain output with the actual member or packed member set.

func Observe

func Observe(ctx context.Context, notify func(Event), verbose bool) context.Context

Observe selects build diagnostics for this operation only. Callbacks are synchronous. pig additive (D18): only explicit build callers select progress reporting.

func Phase

func Phase(ctx context.Context, phase, step string)

Phase reports a phase immediately before its work begins.

func Run

func Run(ctx context.Context, cmd *exec.Cmd) error

Run streams toolchain output and retains only its diagnostic tail on failure.

func ToolArgs

func ToolArgs(ctx context.Context, language string, args []string) []string

ToolArgs changes diagnostic verbosity only; it does not change build inputs.

func Verbose

func Verbose(ctx context.Context) bool

Verbose reports whether this build requests raw toolchain output.

Types

type Event

type Event struct {
	Phase  string
	Step   string
	Member string
	Output string
}

Event describes work that has started, or a line emitted by its toolchain.

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter owns a build's status animation. Close joins its timer before returning.

func New

func New(out io.Writer, verbose bool) *Reporter

New starts a live display only when out is a terminal; pipes receive plain phase lines.

func (*Reporter) Close

func (r *Reporter) Close()

Close clears the live display and stops all further writes. It is idempotent.

func (*Reporter) Failure

func (r *Reporter) Failure(err error) error

Failure includes the last real phase and an actionable hint. Long compiler output is reduced to its diagnostic tail and terminal controls are removed.

func (*Reporter) Handle

func (r *Reporter) Handle(event Event)

Handle consumes a real phase or toolchain line. It is safe for concurrent tool output.

func (*Reporter) Success

func (r *Reporter) Success(path string, size int64)

Success prints the completed binary path, size, and total elapsed time after joining the display.

func (*Reporter) Write

func (r *Reporter) Write(p []byte) (int, error)

Write displays a diagnostic block without terminal controls or overwriting the live status rows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL