Fmt
fmt is a software library or package that provides formatted text generation and, in some implementations, formatted input and output operations.
Go in Action, Second Edition
The fmt package is a Go standard-library package that provides formatted input and output operations.
- How it is used
- Handles console output, formatted string construction, simple input, and basic error reporting in Go applications.
- How deep it goes
- Explains core printing, formatting verbs, string builders, input, and formatted errors, while deferring advanced logging options.
- Examples
- Uses word-count output, a versioned JSON/XML conversion CLI, interactive JSON input, formatting verbs, and printed key-value-store errors.
- What you can do after
- Apply it via fmt functions to print, format strings, read simple input, and create or display formatted errors.
Learn Go with Pocket-Sized Projects
fmt is Go's standard library package for formatted I/O operations.
- How it is used
- Provides formatted output for Go programs, including simple debugging through Println.
- How deep it goes
- Explains importing fmt, calling Println, standard output, and exported names without detailing the wider formatting family.
- Examples
- Uses a main.go Hello world program and notes human-readable integer and Boolean output.
- What you can do after
- Apply it via fmt.Println to write strings and basic values to standard output.
Learn C++ by Example
fmt is an open-source C++ formatting library that provides format-string-based text formatting facilities.
- How it is used
- Provides portable formatted output when compiler support for std::format is incomplete.
- How deep it goes
- Explains installation, placeholders, specifiers, type checking, and alignment, but limits usage to commonly supported features.
- Examples
- Formats integers into a center-justified triangle using fixed and dynamically supplied widths.
- What you can do after
- Apply it via fmt::format to produce aligned, type-checked C++ output.
Related concepts
- fmt.Printlnhas part · fmt.Println is a Go standard-library function that writes its arguments separated by spaces and followed by a newline.
- import statementused by · An import statement is a source-code declaration that makes names or definitions from another module, package, or namespace available in the current scope.
- format methodalternative to · A format method is an API operation that produces a formatted representation by substituting supplied values into a formatting specification.
- standard librarykind of · A standard library is a collection of reusable modules, types, functions, APIs, and other facilities distributed with a programming language implementation or platform.
- packagekind of · A package is a programming-language namespace and organizational unit that groups related code and may define import, compilation, or access boundaries.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


