Fmt

fmt package

May 28, 2024
Golang, Fmt

formatting verbs # %s vs %q? Answer: %s prints the string without enclosing it in quotes. %q prints the string enclosed in double quotes, %q can print string, byte slice, runes and int. %v vs %+v vs %#v? Answer: %v: Default format, prints the value as is. For structs, it prints only the field values. %+v: Detailed format, includes field names in structs. %#v: Go-syntax representation, includes type information and can be used to recreate the value in Go code. ...