gc: don't emit pkgpath for error type.
Fixes #2660.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5557060
diff --git a/src/pkg/reflect/all_test.go b/src/pkg/reflect/all_test.go
index 2f9f83f..63b127d 100644
--- a/src/pkg/reflect/all_test.go
+++ b/src/pkg/reflect/all_test.go
@@ -1364,8 +1364,19 @@
}
func TestImportPath(t *testing.T) {
- if path := TypeOf(&base64.Encoding{}).Elem().PkgPath(); path != "encoding/base64" {
- t.Errorf(`TypeOf(&base64.Encoding{}).Elem().PkgPath() = %q, want "encoding/base64"`, path)
+ tests := []struct {
+ t Type
+ path string
+ }{
+ {TypeOf(&base64.Encoding{}).Elem(), "encoding/base64"},
+ {TypeOf(uint(0)), ""},
+ {TypeOf(map[string]int{}), ""},
+ {TypeOf((*error)(nil)).Elem(), ""},
+ }
+ for _, test := range tests {
+ if path := test.t.PkgPath(); path != test.path {
+ t.Errorf("%v.PkgPath() = %q, want %q", test.t, path, test.path)
+ }
}
}