progress

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package progress carries transient operation messages through a context to an optional observer.

Report serializes callbacks from concurrent operations. Observers must return promptly and avoid recursive reporting. Messages describe activity in the current process; what lasts is recorded in the store, and read from there.

Package progress carries user-facing progress reports from operations to whoever is watching: the CLI prints them, a check's run keeps the ones a person following it needs, and tests collect them. Nothing decides anything by them. Reports are sentences for a person, not log lines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After added in v0.4.0

func After(ctx context.Context, delay time.Duration, format string, args ...any) (stop func())

After reports, once, at info level, what a step waits on, where it has run for longer than delay: the first outdated after a rebuild printed nothing for 13 minutes, waiting on something it didn't say (field testing at c9ad2112). A step that ends sooner says nothing. stop ends the wait, and is safe to call more than once.

func DebugReport

func DebugReport(ctx context.Context, format string, args ...any)

DebugReport emits a report about a sub-operation.

func Keep

func Keep(ctx context.Context, keep func(Update)) context.Context

Keep is Observe for an observer that keeps the info reports made under ctx for whoever follows the work, as a check's run keeps each environment's: a command driving it Quiet shows them through that record, so its reporter lowers them to debug rather than verbose, and -v doesn't show each twice, once bare and once kept (the hugo exercise's check-64).

func Observe

func Observe(ctx context.Context, observe func(Update)) context.Context

Observe has the reports made under ctx go to observe as well as to the reporter, at the level they were made: Quiet lowers what a command shows of the work it drives, not what the work's own record keeps. Callbacks are serialized; observe should return promptly and must not report under the context Observe returns.

func Quiet

func Quiet(ctx context.Context) context.Context

Quiet lowers the info reports made under ctx to verbose. A command that drives the workflow only to see its own job through is not the driver's audience: what the engine and providers say as they work is the work behind the scenes to it, and its own narrative says what matters. A resident driver reports under the plain context and keeps every line.

func Report

func Report(ctx context.Context, format string, args ...any)

Report emits an info-level report.

func ReportOnce

func ReportOnce(ctx context.Context, format string, args ...any)

ReportOnce emits an info-level report the first time it's made to the command's reporter, and not again: a notice about the work, such as a port being a stub, that each pass over the same work would repeat.

func VerboseReport

func VerboseReport(ctx context.Context, format string, args ...any)

VerboseReport emits a report for people who asked for more.

func WithReporter

func WithReporter(ctx context.Context, report func(Update)) context.Context

WithReporter serializes callbacks, including those from concurrent operations. The callback should return promptly and must not report recursively.

func Within

func Within(ctx context.Context, about string) context.Context

Within has the reports made under ctx say first what they're about, as "macOS 15 (Tart): ": two environments of a check stage at once, and their lines were told apart only by their order (the hugo exercise's check-64). Within an earlier one, both are said, outer first.

Types

type Level

type Level int

Level says who a report is for. Info is the minimum a person needs to follow a command; Verbose adds identifiers and the work behind the scenes; Debug adds every sub-operation.

const (
	Info Level = iota
	Verbose
	Debug
)

func (Level) String

func (l Level) String() string

type Update

type Update struct {
	Level   Level
	Message string
	// About is what the report is about, as Within said, which Message
	// begins with too: a part of the work, as one environment of a check.
	About string
}

Jump to

Keyboard shortcuts

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