diff options
Diffstat (limited to 'libgo/go/runtime')
-rw-r--r-- | libgo/go/runtime/error.go | 10 | ||||
-rw-r--r-- | libgo/go/runtime/pprof/pprof.go | 5 |
2 files changed, 8 insertions, 7 deletions
diff --git a/libgo/go/runtime/error.go b/libgo/go/runtime/error.go index 2b5517f..c5168a7 100644 --- a/libgo/go/runtime/error.go +++ b/libgo/go/runtime/error.go @@ -6,11 +6,11 @@ package runtime // The Error interface identifies a run time error. type Error interface { - String() string + error // RuntimeError is a no-op function but // serves to distinguish types that are runtime - // errors from ordinary os.Errors: a type is a + // errors from ordinary errors: a type is a // runtime error if it has a RuntimeError method. RuntimeError() } @@ -28,7 +28,7 @@ type TypeAssertionError struct { func (*TypeAssertionError) RuntimeError() {} -func (e *TypeAssertionError) String() string { +func (e *TypeAssertionError) Error() string { inter := e.interfaceString if inter == "" { inter = "interface" @@ -98,7 +98,7 @@ type errorString string func (e errorString) RuntimeError() {} -func (e errorString) String() string { +func (e errorString) Error() string { return "runtime error: " + string(e) } @@ -123,6 +123,8 @@ func Printany(i interface{}) { print("nil") case stringer: print(v.String()) + case error: + print(v.Error()) case int: print(v) case string: diff --git a/libgo/go/runtime/pprof/pprof.go b/libgo/go/runtime/pprof/pprof.go index 7022896..d14bb14 100644 --- a/libgo/go/runtime/pprof/pprof.go +++ b/libgo/go/runtime/pprof/pprof.go @@ -12,7 +12,6 @@ import ( "bufio" "fmt" "io" - "os" "runtime" "sync" ) @@ -23,7 +22,7 @@ import ( // WriteHeapProfile writes a pprof-formatted heap profile to w. // If a write to w returns an error, WriteHeapProfile returns that error. // Otherwise, WriteHeapProfile returns nil. -func WriteHeapProfile(w io.Writer) os.Error { +func WriteHeapProfile(w io.Writer) error { // Find out how many records there are (MemProfile(nil, false)), // allocate that many records, and get the data. // There's a race—more records might be added between @@ -119,7 +118,7 @@ var cpu struct { // StartCPUProfile enables CPU profiling for the current process. // While profiling, the profile will be buffered and written to w. // StartCPUProfile returns an error if profiling is already enabled. -func StartCPUProfile(w io.Writer) os.Error { +func StartCPUProfile(w io.Writer) error { // The runtime routines allow a variable profiling rate, // but in practice operating systems cannot trigger signals // at more than about 500 Hz, and our processing of the |