Commit 558477ee authored by Andrew Gerrand's avatar Andrew Gerrand

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
parent 57858b70
...@@ -159,6 +159,12 @@ func Sprintf(format string, a ...interface{}) string { ...@@ -159,6 +159,12 @@ func Sprintf(format string, a ...interface{}) string {
return s 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 // These routines do not take a format string
// Fprint formats using the default formats for its operands and writes to w. // Fprint formats using the default formats for its operands and writes to w.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment