This is a creation in Article, where the information may have evolved or changed.
Package Main
Import "FMT"
Func Main () {
Fmt. Print ("Hello, world\n")
}
Run output HelloWorld;
Content analysis:
The FMT:FMT package implements the format I/O functions, similar to the C printf and scanf. The format placeholder is derived from C, but is simpler than c.
So so:
%v the default format for the corresponding value. When the structure is printed, the "Plus" mark (%+v) adds a field name of% #v相应值的Go语法表示%t the corresponding value of the type of the go syntax to represent the percent percent of the literal percentile, not the value of the placeholder
Boolean:
%t the word True or false.
Integer:
The%b binary represents the character%d denoted by the corresponding Unicode code point in%c, the decimal representation of the%o octal representation of the character literal that surrounds the%q single quotation mark, which is safely escaped by the go syntax in the hexadecimal notation, in lowercase a-f%x hexadecimal notation, and in uppercase letters a-f% Uunicode format: u+1234, equivalent to "u+%04x"
Floating point number and its compound composition:
%b is a scientific notation of the power of the exponent two without fractional parts, with StrConv. The formatfloat ' B ' conversion format is consistent. For example, -123456p-78%e scientific notation, such as the -1234.456e+78%e scientific notation, for example -1234.456e+78%f has a decimal point but no exponent, for example 123.456%g chooses%e or%f as appropriate to produce a more compact (no end 0) output% G Select%E or%f as appropriate to produce a more compact (no end 0) output
String and byte slices:
%s string or slice without interpretation byte%q double quotation marks around the string, safely escaped by go syntax%x 16, lowercase letters, two characters per byte%x 16, uppercase letters, two characters per byte
Pointer:
%p hexadecimal representation, prefix 0x
Thanks for the information provided by the Go language Chinese web