fmt API Reference
Go fmt package — formatted I/O with C-style verbs.
fmt
Package fmt implements formatted I/O with functions analogous to C's printf and scanf.
fmt.Print(a ...any) (n int, err error)Print using default formats for each operand. Spaces added between operands when neither is a string.
Returns: (int, error)
fmt.Println(a ...any) (n int, err error)Print using default formats, with spaces between operands and a newline at the end.
Returns: (int, error)
fmt.Printf(format string, a ...any) (n int, err error)Print according to a format specifier.
Returns: (int, error)
fmt.Sprintf(format string, a ...any) stringReturn a string (instead of printing) according to a format specifier.
Returns: string
fmt.Fprintf(w io.Writer, format string, a ...any) (n int, err error)Write to w according to a format specifier.
Returns: (int, error)
fmt.Scanf(format string, a ...any) (n int, err error)Scan text read from standard input, storing successive space-separated values into successive arguments.
Returns: (int, error)
fmt.Errorf(format string, a ...any) errorReturn an error that formats according to a format specifier. Wraps with %w.
Returns: error