The format specifier. It’s the first required argument of type string. It describes how the other arguments shall be formatted. The syntax of the specifier is described in the packages documentation.
An error that can happen when writing into a file.
So in:
func Printf(format string, a …interface{}) (n int, err error)
is n int the format specifier? Looks like the first argument.
Please forgive my ignorance.
I spent 27 minutes just forming this question
If we refer back to this example, @NobbZ refers to that "DEBUG: %s, the return value is %d.\n" string. Essentially, it its telling Printf how to form the final string I wanted to see.
name money
🡣 🡣
fmt.Printf("DEBUG: %s, the return value is %d.\n", name, money)
The word format has been shrouded in mystery for me ever since the days when we used to format discs and I had no clue what that meant.
The first definition I found
A format program is a type of software that prepares a disk for reading and writing data on a system.
Is this what we are talking about?
https://en.wikipedia.org › wiki › Programming_style
Interesting article written on my level.
Software has long been available that formats source code automatically, leaving coders to concentrate on naming, logic, and higher techniques. As a practical point, using a computer to format source code saves time,
Words can have multiple meaning in distinct different contexts.
In case of “format” all of the meanings loosely follow the metaphor of making something fit into a given or expected shape.
Randomly searching the web for single words therefore rarely brings up what you need. Even if you narrow down a bit by adding “computer” to the search, thats not helping much.
And in this special case you already know the canonical source of truth, the documenation of gos fmt package (which is short for format).
This package has the purpose of formatting strings into the terminal, files, or other strings.