]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: print unknown types in panic
authorRuss Cox <rsc@golang.org>
Fri, 22 Oct 2010 21:04:32 +0000 (17:04 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 22 Oct 2010 21:04:32 +0000 (17:04 -0400)
R=r
CC=golang-dev
https://golang.org/cl/2683041

src/pkg/runtime/error.go
src/pkg/runtime/print.c

index 673e77b2c12a471e1150e6d5ab7e1dfeeceb29f5..289d78f49f7038228148c33af367857213c95598 100644 (file)
@@ -111,6 +111,8 @@ type stringer interface {
        String() string
 }
 
+func typestring(interface{}) string
+
 // For calling from C.
 // Prints an argument passed to panic.
 // There's room for arbitrary complexity here, but we keep it
@@ -126,6 +128,6 @@ func printany(i interface{}) {
        case string:
                print(v)
        default:
-               print(i)
+               print("(", typestring(i), ") ", i)
        }
 }
index aa207e312468151cdaecaad5ada9de9f16eacf47..cf3788618337a6be8976c39c717e844a685aad92 100644 (file)
@@ -348,3 +348,11 @@ void
 {
        write(fd, "\n", 1);
 }
+
+void
+·typestring(Eface e, String s)
+{
+       s = *e.type->string;
+       FLUSH(&s);
+}
+