diff options
| author | Todd Neal <todd@tneal.org> | 2017-04-07 15:41:19 -0500 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-04-09 22:40:33 +0000 |
| commit | 0d33dc3105734dcd262c3104076e05a363b802b1 (patch) | |
| tree | 6417e7a1ce336b22b439bbdd4214bd594877f799 /src/runtime/error.go | |
| parent | 5de5dd8d25d17fa8893ee7244c1cb02e87d5ccfd (diff) | |
| download | go-0d33dc3105734dcd262c3104076e05a363b802b1.tar.xz | |
runtime: improve output of panic(x) where x is numeric
Fixes #19658
Change-Id: I41e46073b75c7674e2ed9d6a90ece367ce92166b
Reviewed-on: https://go-review.googlesource.com/39650
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/error.go')
| -rw-r--r-- | src/runtime/error.go | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/runtime/error.go b/src/runtime/error.go index f5b015c091..eafcc9b173 100644 --- a/src/runtime/error.go +++ b/src/runtime/error.go @@ -74,8 +74,6 @@ func typestring(x interface{}) string { // For calling from C. // Prints an argument passed to panic. -// There's room for arbitrary complexity here, but we keep it -// simple and handle just a few important cases: int, string, and Stringer. func printany(i interface{}) { switch v := i.(type) { case nil: @@ -84,8 +82,38 @@ func printany(i interface{}) { print(v.String()) case error: print(v.Error()) + case bool: + print(v) case int: print(v) + case int8: + print(v) + case int16: + print(v) + case int32: + print(v) + case int64: + print(v) + case uint: + print(v) + case uint8: + print(v) + case uint16: + print(v) + case uint32: + print(v) + case uint64: + print(v) + case uintptr: + print(v) + case float32: + print(v) + case float64: + print(v) + case complex64: + print(v) + case complex128: + print(v) case string: print(v) default: |
