You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package fmt
Format errors:
Wrong type or unknown verb: %!verb(type=value)
Printf("%d", hi): %!d(string=hi)
Too many arguments: %!(EXTRA type=value)
Printf("hi", "guys"): hi%!(EXTRA string=guys)
Too few arguments: %!verb(MISSING)
Printf("hi%d"): hi %!d(MISSING)
Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC)
Printf("%*s", 4.5, "hi"): %!(BADWIDTH)hi
Printf("%.*s", 4.5, "hi"): %!(BADPREC)hi
Invalid or invalid use of argument index: %!(BADINDEX)
Printf("%*[2]d", 7): %d(BADINDEX)
Printf("%.[2]d", 7): %d(BADINDEX)
All errors begin with the string "%!".
The documentation error descriptions are correct. All errors begin with the string
"%!".
The documentation sample output is sometimes incorrect:
Printf("%*[2]d", 7): %d(BADINDEX)
Printf("%.[2]d", 7): %d(BADINDEX)
The actual output is sometimes incorrect:
hi%d(MISSING)
%d(BADINDEX)
%d(BADINDEX)
go version devel +4298a713c372 Tue Jun 18 17:15:26 2013 -0700 linux/amd64
package main
import (
. "fmt"
)
func main() {
// package fmt
// fmt/doc.go
// Format errors:
hi := "hi"
// Wrong type or unknown verb: %!verb(type=value)
Printf("%d", hi) // : %!d(string=hi)
Println()
// Too many arguments: %!(EXTRA type=value)
Printf("hi", "guys") // : hi%!(EXTRA string=guys)
Println()
// Too few arguments: %!verb(MISSING)
Printf("hi%d") // : hi %!d(MISSING)
Println()
// Non-int for width or precision: %!(BADWIDTH) or %!(BADPREC)
Printf("%*s", 4.5, "hi") // : %!(BADWIDTH)hi
Println()
Printf("%.*s", 4.5, "hi") // : %!(BADPREC)hi
Println()
// Invalid or invalid use of argument index: %!(BADINDEX)
Printf("%*[2]d", 7) // : %d(BADINDEX)
Println()
Printf("%.[2]d", 7) // : %d(BADINDEX)
Println()
// All errors begin with the string "%!".
}
http://play.golang.org/p/Ojl6QtD_RZ
Output:
%!d(string=hi)
hi%!(EXTRA string=guys)
hi%d(MISSING)
%!(BADWIDTH)hi
%!(BADPREC)hi
%d(BADINDEX)
%d(BADINDEX)
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: