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

scanbuf

package
v1.45.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package scanbuf provides a pooled buffer for bufio.Scanner instances that need to handle large JSONL lines (base64-encoded tool output, etc.). Allocating a fresh multi-MB buffer per scan is a significant allocation source for pollers that scan many files per tick; pooling amortizes it.

Index

Constants

View Source
const MaxTokenSize = 10 * 1024 * 1024

MaxTokenSize is the maximum line size supported by buffers from this pool.

Variables

This section is empty.

Functions

func Get

func Get() *[]byte

Get returns a buffer of length MaxTokenSize for use with bufio.Scanner.Buffer. The caller must return it via Put when done.

func Put

func Put(buf *[]byte)

Put returns a buffer acquired from Get back to the pool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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