...

/

Formatting with Package "fmt"

Formatting with Package "fmt"

Learn about the fmt package in the Go standard library.

The fmt package

Here is a list of features provided by the fmt package:

  • Format things like basic strings and values.
  • Print data to the console.
  • Collect user input from the console.
  • Write into a file using a writer.
  • Print error messages.

Templates

The fmt package relies on the concept of a format template. Essentially, this is only a string that contains the text we want to manage plus some placeholders called verbs that tell fmt ...