Standard library / fmt

fmt.general-verbs

%v uses the default representation; %+v includes struct field names; %#v uses Go-syntax representation where possible; %T reports the Go type; %% emits a literal percent sign and consumes no argument. %t formats a bool; %p formats a pointer address (not stable output). Expected stdout: '42 int true %\n'.

Formal Syntax & Structure

go syntaxgo
%v %+v %#v %T %t %p %%

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  fmt.Printf("%v %T %t %%\n", 42, 42, true)}
Go Reference