fmt.Fprintf

The fmt functions that write formatted text to a destination you choose, such as os.Stderr, a file or an HTTP response.

In more detail

The destination is any io.Writer, so the same call can print to a terminal, a file or a web response. Command-line tools use fmt.Fprintln(os.Stderr, ...) for usage and error messages so standard output stays clean for results.

Example

fmt.Fprintf(os.Stderr, "%d unhealthy\n", unhealthy)

Related terms

Taught in

References