Help us shape the future of Go! Take the 2026 Go Developer Survey

progress

package
v0.2.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package progress shares the progress and cancellation of one long-running operation between the goroutine doing the work and whoever displays it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCanceled

func IsCanceled(err error) bool

IsCanceled reports whether err is a user abort rather than a real failure.

Types

type Progress

type Progress struct {
	Phase         string
	Done          int
	Total         int
	Indeterminate bool
}

Progress describes the current phase of a network operation.

type Tracker

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

Tracker safely shares progress between a tea.Cmd goroutine and the TUI.

func NewTracker

func NewTracker(phase string) *Tracker

NewTracker creates an indeterminate tracker with the given initial phase.

func (*Tracker) Cancel

func (t *Tracker) Cancel()

Cancel asks the running operation to stop. Already-finished work is kept.

func (*Tracker) Canceled

func (t *Tracker) Canceled() bool

Canceled reports whether Cancel has been called.

func (*Tracker) Context

func (t *Tracker) Context() context.Context

Context is canceled when the user aborts the operation.

func (*Tracker) Finish

func (t *Tracker) Finish()

Finish marks the tracked operation as complete.

func (*Tracker) Inc

func (t *Tracker) Inc()

Inc advances the completed counter by one.

func (*Tracker) Set

func (t *Tracker) Set(phase string, done, total int, indeterminate bool)

Set replaces the current progress values.

func (*Tracker) Snapshot

func (t *Tracker) Snapshot() (Progress, bool)

Snapshot returns a consistent progress snapshot.

Jump to

Keyboard shortcuts

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