liveBook · Manning

Fmt

As explained in Learn Go with Pocket-Sized Projects

fmt is Go's standard library package for formatted I/O operations.

fmt is Go’s standard-library package for formatting and outputting data. Import it to make functions such as fmt.Println available in a program. section 2.1.1

fmt.Println writes to standard output, displays integers and Boolean values in human-readable form, and provides a convenient option for cheap debugging. section 2.1.1

Print a greeting

Import fmt in a main package and call fmt.Println("Hello world") to write a line to standard output. section 2.1.1

Listing 2.1 main.go
package main

import "fmt"

func main() {
    fmt.Println("Hello world")
}       

Runnable main.go example showing the fmt import and a fmt.Println call. section 2.1.1

How Learn Go with Pocket-Sized Projects covers it

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.
How it connects
Connects fmt to packages, imports, standard output, debugging, and exported identifiers.

Also explained in

Compare how 3 books explain fmt →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Go with Pocket-Sized Projects. The section links point to the parts of the book it draws on.