This is a creation in Article, where the information may have evolved or changed.
String formatted output
PackageMainImport "FMT"Import "OS"typePointstruct{x, Yint}funcMain () {//Create a point structP: = Point{1,2}//Output struct value {1 2}Fmt. Printf ("%v\n", p)//Output struct value and field {x:1 Y:2}Fmt. Printf ("%+v\n", p)//Output struct type and field and value Main.point{x:1, y:2}Fmt. Printf ("% #v \ n", p)//Output type Main.pointFmt. Printf ("%t\n", p)//Output neat arrangement trueFmt. Printf ("%t\n",true)//Output Digital 123Fmt. Printf ("%d\n",123)//Output binaryFmt. Printf ("%b\n", -)//INT output to char typeFmt. Printf ("%c\n", -)//output 16 binary 1c8Fmt. Printf ("%x\n",456)//formatted output float type 78.900000Fmt. Printf ("%f\n",78.9)//1.234000e+08 //1.234000E+08Fmt. Printf ("%e\n",123400000.0) FMT. Printf ("%e\n",123400000.0)//Base string Output "string"Fmt. Printf ("%s\n","\" string\ "")//String output with reference base "\" string\ ""Fmt. Printf ("%q\n","\" string\ "")//Output byte 6865782074686973Fmt. Printf ("%x\n","Hex This")//Output address 0x42135100Fmt. Printf ("%p\n", &p)//Right-aligned output | 12| 345|Fmt. Printf ("|%6d|%6d|\n", A,345)//Right-aligned output | 1.20| 3.45|Fmt. Printf ("|%6.2f|%6.2f|\n",1.2,3.45)//Use-flag, left-aligned output |1.20 |3.45 |Fmt. Printf ("|%-6.2f|%-6.2f|\n",1.2,3.45)//Right-aligned output | foo| b|Fmt. Printf ("|%6s|%6s|\n","foo","B")//Use-flag, left-aligned output |foo |b |Fmt. Printf ("|%-6s|%-6s|\n","foo","B")//Return only data not outputS: = Fmt. Sprintf ("a%s","string") FMT. PRINTLN (s)//Can format+print to IO. Writers other than OS. Stdout using fprintf.Fmt. fprintf (OS. Stderr,"an%s\n","Error")}