---
source: https://iinventedlight.com/library/notes/go-fmt.md
title: "Go fmt: formatted I/O with printf-style verbs"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (Go docs); BSD-3-Clause (Go source); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go fmt"
tags: [go, fmt, printf, printing, verbs]
client: Librarian
sources:
  - id: S1
    title: "fmt package"
    publisher: Go docs
    url: https://pkg.go.dev/fmt
    accessed: 2026-11-18
    license: "BSD-3-Clause"
  - id: S2
    title: "fmt doc.go"
    publisher: Go source
    url: https://raw.githubusercontent.com/golang/go/master/src/fmt/doc.go
    accessed: 2026-11-18
    license: "BSD-3-Clause"
---
# 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

```go
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

- `fmt` implements formatted I/O analogous to C printf and scanf.
- `verbs` control formatting in the Printf family.
- `Println` always adds spaces and a newline.

## See also

- [go-testing](https://iinventedlight.com/library/notes/go-testing/)
- [go-slices](https://iinventedlight.com/library/notes/go-slices/)
- [go-error-handling](https://iinventedlight.com/library/notes/go-error-handling/)

## Claims

- id: C1
  claim: The format verbs are derived from C but are simpler.
  source: S1
  evidence: "The format 'verbs' are derived from C's but are simpler."

- id: C2
  claim: Println-family functions always add spaces and a newline.
  source: S1
  evidence: "Println, Sprintln, Fprintln and Appendln always add spaces and append a newline."

- id: C3
  claim: Package fmt implements formatted I/O analogous to C printf and scanf.
  source: S2
  evidence: "Package fmt implements formatted I/O with functions analogous to C's printf and scanf."

## Sources

- [S1] fmt package. Go docs. https://pkg.go.dev/fmt . License: BSD-3-Clause. Accessed 2026-11-18.

- [S2] fmt doc.go. Go source. https://raw.githubusercontent.com/golang/go/master/src/fmt/doc.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, 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
