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

buflimit

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package buflimit provides bounded in-memory command output capture.

Index

Constants

This section is empty.

Variables

View Source
var ErrOutputLimit = errors.New("output exceeds limit")

ErrOutputLimit reports that a Buffer retained its byte limit and rejected the remainder of a write.

Functions

This section is empty.

Types

type Buffer

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

Buffer retains at most a fixed number of bytes.

func NewBuffer

func NewBuffer(limit int) *Buffer

NewBuffer returns an empty Buffer with a non-negative byte limit.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns the retained bytes.

func (*Buffer) Err

func (b *Buffer) Err() error

Err returns the output-limit error recorded by Write, if any.

func (*Buffer) Exceeded

func (b *Buffer) Exceeded() bool

Exceeded reports whether a write exceeded the configured limit.

func (*Buffer) String

func (b *Buffer) String() string

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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