mirror of https://github.com/golang/go.git
fmt: add Errorf helper function
This crops up in a lot of places. It's just a one-liner, but doesn't add any dependancies. Seems worth it. R=r, r2 CC=golang-dev https://golang.org/cl/2344041
This commit is contained in:
parent
57858b70fb
commit
558477eeb1
|
|
@ -159,6 +159,12 @@ func Sprintf(format string, a ...interface{}) string {
|
|||
return s
|
||||
}
|
||||
|
||||
// Errorf formats according to a format specifier and returns the string
|
||||
// converted to an os.ErrorString, which satisfies the os.Error interface.
|
||||
func Errorf(format string, a ...interface{}) os.Error {
|
||||
return os.ErrorString(Sprintf(format, a...))
|
||||
}
|
||||
|
||||
// These routines do not take a format string
|
||||
|
||||
// Fprint formats using the default formats for its operands and writes to w.
|
||||
|
|
|
|||
Loading…
Reference in New Issue