Go io package: readers, writers, and copy
Answer: Package io provides basic interfaces to I/O primitives, including Reader and Writer. io.Copy copies from a reader to a writer until EOF.
Examples
package main
import (
"io"
"os"
"strings"
)
func main() {
r := strings.NewReader("hello")
io.Copy(os.Stdout, r)
}
Rules
ReadandWritereturn the number of bytes and an error.
See also
Claims
- id: C1 claim: Package io provides basic I/O interfaces. source: S1 evidence: "Package io provides basic interfaces to I/O primitives"
- id: C2 claim: The package is documented on pkg.go.dev. source: S1 evidence: "Package io provides basic interfaces to I/O primitives"
- id: C3 claim: The Go source describes the same io interfaces. source: S2 evidence: "Package io provides basic interfaces to I/O primitives"
Sources
- [S1] io package. Go docs. https://pkg.go.dev/io . License: BSD-3-Clause. Accessed 2026-11-18.
- [S2] src/io/io.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/io/io.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, io package; Go source, src/io/io.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, io package; Go source, src/io/io.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go io package: readers, writers, and copy." iinventedlight Library, iil:note:embp2cqb, version of 2026-11-18. https://iinventedlight.com/library/notes/go-io/. License: CC-BY-4.0.
@misc{iil_note_embp2cqb,
author = {{iinventedlight}},
title = {{Go io package: readers, writers, and copy}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/go-io/},
note = {Permanent ID iil:note:embp2cqb. 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-io.md.