From 0eac03b836dd917e9beeb8fd353a4bca5125a853 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 19 Feb 2014 17:55:30 -0500 Subject: [PATCH] go.tools/go/types: include import path in (*Package).String() LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/66120045 --- go/types/object.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/go/types/object.go b/go/types/object.go index 670b8d6b..4c2a8ca0 100644 --- a/go/types/object.go +++ b/go/types/object.go @@ -226,8 +226,11 @@ func writeObject(buf *bytes.Buffer, this *Package, obj Object) { typ := obj.Type() switch obj := obj.(type) { case *PkgName: - buf.WriteString("package") - typ = nil + fmt.Fprintf(buf, "package %s", obj.Name()) + if path := obj.Pkg().path; path != "" && path != obj.Name() { + fmt.Fprintf(buf, " (%q)", path) + } + return case *Const: buf.WriteString("const")