1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:34:46 -07:00

runtime: print unknown types in panic

R=r
CC=golang-dev
https://golang.org/cl/2683041
This commit is contained in:
Russ Cox 2010-10-22 17:04:32 -04:00
parent e5e9211071
commit 1dd0319be3
2 changed files with 11 additions and 1 deletions

View File

@ -111,6 +111,8 @@ type stringer interface {
String() string String() string
} }
func typestring(interface{}) string
// For calling from C. // For calling from C.
// Prints an argument passed to panic. // Prints an argument passed to panic.
// There's room for arbitrary complexity here, but we keep it // There's room for arbitrary complexity here, but we keep it
@ -126,6 +128,6 @@ func printany(i interface{}) {
case string: case string:
print(v) print(v)
default: default:
print(i) print("(", typestring(i), ") ", i)
} }
} }

View File

@ -348,3 +348,11 @@ void
{ {
write(fd, "\n", 1); write(fd, "\n", 1);
} }
void
·typestring(Eface e, String s)
{
s = *e.type->string;
FLUSH(&s);
}