aboutsummaryrefslogtreecommitdiff
path: root/oracle
diff options
context:
space:
mode:
authorAlan Donovan <adonovan@google.com>2014-04-15 15:37:44 -0400
committerAlan Donovan <adonovan@google.com>2014-04-15 15:37:44 -0400
commitb3970ee1594dc2937d8127386552f6258af2beeb (patch)
treef4a14bf60aa33ede0e992bff1ec3c7746c2e90ca /oracle
parentbc722df585c4b1482e035d6c989a1780b772978f (diff)
downloadtools-b3970ee1594dc2937d8127386552f6258af2beeb.tar.gz
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
Diffstat (limited to 'oracle')
-rw-r--r--oracle/describe.go2
-rw-r--r--oracle/testdata/src/main/imports.go5
-rw-r--r--oracle/testdata/src/main/imports.golden7
3 files changed, 12 insertions, 2 deletions
diff --git a/oracle/describe.go b/oracle/describe.go
index 8f379de..149172c 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 111c86e..2f5ffa4 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 5cc8182..788a3ad 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