Go bufio: buffered readers, writers, and scanners
Answer: Package bufio implements buffered I/O for readers and writers. Scanner is a convenient API for reading data such as lines.
Examples
package main
import (
"bufio"
"os"
)
func main() {
s := bufio.NewScanner(os.Stdin)
for s.Scan() {
_ = s.Text()
}
}
Notes
Reference list
Packagebufio implements buffered I/O.
See also
Claims
- id: C1 claim: Package bufio implements buffered I/O. source: S1 evidence: "Package bufio implements buffered I/O"
- id: C2 claim: It wraps an io.Reader or io.Writer object. source: S2 evidence: "It wraps an io.Reader or io.Writer"
- id: C3 claim: The package also documents Scanner. source: S2 evidence: "use a [Scanner]"
Sources
- [S1] bufio package. Go docs. https://pkg.go.dev/bufio . License: BSD-3-Clause. Accessed 2026-11-18.
- [S2] bufio.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/bufio/bufio.go . License: BSD-3-Clause. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, bufio package; Go source, bufio.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Go docs, bufio package; Go source, bufio.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go bufio: buffered readers, writers, and scanners." iinventedlight Library, iil:note:fre530dv, version of 2026-11-18. https://iinventedlight.com/library/notes/go-bufio/. License: CC-BY-4.0.
@misc{iil_note_fre530dv,
author = {{iinventedlight}},
title = {{Go bufio: buffered readers, writers, and scanners}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/go-bufio/},
note = {Permanent ID iil:note:fre530dv. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-bufio.md.