diff --git a/oracle/describe.go b/oracle/describe.go index 2743f67c6d..70ddacfd7e 100644 --- a/oracle/describe.go +++ b/oracle/describe.go @@ -680,6 +680,12 @@ func tokenOf(o types.Object) string { return "const" case *types.PkgName: return "package" + case *types.Builtin: + return "builtin" // e.g. when describing package "unsafe" + case *types.Nil: + return "nil" + case *types.Label: + return "label" } panic(o) } diff --git a/oracle/testdata/src/describe/main.go b/oracle/testdata/src/describe/main.go index 1cdcd3cdb2..f48d6d0dc1 100644 --- a/oracle/testdata/src/describe/main.go +++ b/oracle/testdata/src/describe/main.go @@ -9,6 +9,7 @@ package describe // @describe pkgdecl "describe" import ( "nosuchpkg" // @describe badimport1 "nosuchpkg" nosuchpkg2 "nosuchpkg" // @describe badimport2 "nosuchpkg2" + _ "unsafe" // @describe unsafe "unsafe" ) var _ nosuchpkg.T diff --git a/oracle/testdata/src/describe/main.golden b/oracle/testdata/src/describe/main.golden index 74b0f803e5..bc6d9f7038 100644 --- a/oracle/testdata/src/describe/main.golden +++ b/oracle/testdata/src/describe/main.golden @@ -19,6 +19,13 @@ Error: can't import package "nosuchpkg" -------- @describe badimport2 -------- Error: can't import package "nosuchpkg" +-------- @describe unsafe -------- +import of package "unsafe" + builtin Alignof + builtin Offsetof + type Pointer unsafe.Pointer + builtin Sizeof + -------- @describe type-ref-builtin -------- reference to built-in type float64