← All notes

Go fmt: formatted I/O with printf-style verbs

Answer: Package fmt implements formatted I/O with functions analogous to C printf and scanf. The format verbs are derived from C but are simpler. Println-family functions always add spaces and a newline, while Printf-family functions use verbs.

Examples

fmt.Println("ok")
fmt.Printf("%s %d
", "n", 1)

Notes

There are four families of printing functions, split by output destination. Names such as Printf, Sprintf, Fprintf, and Appendf share the same verb rules.

Reference list

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Go docs, fmt package; Go source, fmt doc.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, fmt package; Go source, fmt doc.go. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.

Cite this

Permanent ID: iil:note:g9heaeta

iinventedlight. 2026. "Go fmt: formatted I/O with printf-style verbs." iinventedlight Library, iil:note:g9heaeta, version of 2026-11-18. https://iinventedlight.com/library/notes/go-fmt/. License: CC-BY-4.0.

@misc{iil_note_g9heaeta,
  author = {{iinventedlight}},
  title = {{Go fmt: formatted I/O with printf-style verbs}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/go-fmt/},
  note = {Permanent ID iil:note:g9heaeta. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-fmt.md.