go.tools/go/oracle: show import path (not just name) when describing an import.
+ test. LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/88190044
This commit is contained in:
parent
bc722df585
commit
b3970ee159
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue