diff --git a/oracle/describe.go b/oracle/describe.go index 8f379def..149172cd 100644 --- a/oracle/describe.go +++ b/oracle/describe.go @@ -498,7 +498,7 @@ func describePackage(o *Oracle, qpos *QueryPos, path []ast.Node) (*describePacka switch n := path[0].(type) { case *ast.ImportSpec: pkgname := qpos.info.ImportSpecPkg(n) - description = fmt.Sprintf("import of package %q", pkgname.Name()) + description = fmt.Sprintf("import of package %q", pkgname.Pkg().Path()) pkg = pkgname.Pkg() case *ast.Ident: diff --git a/oracle/testdata/src/main/imports.go b/oracle/testdata/src/main/imports.go index 111c86ef..2f5ffa43 100644 --- a/oracle/testdata/src/main/imports.go +++ b/oracle/testdata/src/main/imports.go @@ -1,7 +1,8 @@ package imports import ( - "lib" // @describe ref-pkg-import "lib" + "hash/fnv" // @describe ref-pkg-import2 "fnv" + "lib" // @describe ref-pkg-import "lib" ) // Tests that import another package. (To make the tests run quickly, @@ -23,4 +24,6 @@ func main() { print(*p + 1) // @pointsto p "p " var _ lib.Type // @describe ref-pkg "lib" + + fnv.New32() } diff --git a/oracle/testdata/src/main/imports.golden b/oracle/testdata/src/main/imports.golden index 5cc81827..788a3ad9 100644 --- a/oracle/testdata/src/main/imports.golden +++ b/oracle/testdata/src/main/imports.golden @@ -1,3 +1,10 @@ +-------- @describe ref-pkg-import2 -------- +import of package "hash/fnv" + func New32 func() hash.Hash32 + func New32a func() hash.Hash32 + func New64 func() hash.Hash64 + func New64a func() hash.Hash64 + -------- @describe ref-pkg-import -------- import of package "lib" const Const untyped int = 3