bufferpkg

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

buffer

复用 bytes.Buffer,降低频繁临时 buffer 分配。

基础用法

buf := bufferpkg.GetBuffer()
defer bufferpkg.PutBuffer(buf)
buf.WriteString("hello")

注意事项

归还后不要继续读写该 buffer;跨 goroutine 使用时由调用方保证生命周期。PutBuffer(nil) 会直接返回。

验证

go test ./buffer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer() *bytes.Buffer

GetBuffer .

func PutBuffer

func PutBuffer(buf *bytes.Buffer)

PutBuffer .

Types

This section is empty.

Jump to

Keyboard shortcuts

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