A minimal Go progress bar library safe for concurrent use, including spinners, colors, and io.Writer integration for byte counts.
Overview
progressbar is a Go module that renders progress in terminal applications without relying on multi-line output, aiming to behave consistently across operating systems. It was created for another file-transfer tool when existing bars proved unreliable.
Basic usage sets a total count and updates completion over time. The bar type implements io.Writer so wrapping readers or writers automatically advances progress based on bytes transferred. Unknown-length operations use a spinner mode when length is set to negative one, with selectable spinner styles from a bundled list.
Customization includes writers, colors, width, descriptions, and themes through option functions documented in the package. The author describes the API as deliberately simple rather than feature-heavy.
Consumers add the module with Go module tooling and import it from application code; it is not a standalone CLI product.
Key features
- Thread-safe progress updates
- io.Writer byte counting
- Spinner mode for unknown length
- Custom colors and themes
- Optional descriptions and width
- OS-agnostic single-line output
Use cases
- Show copy or download progress
- Wrap io.Reader progress in CLI tools
- Display indeterminate spinners
- Add colored terminal feedback
- Embed bars in Go command-line apps