From 33f2a1701b45b3fb6d1749baef77fc38eccb2490 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Thu, 27 Mar 2014 10:03:51 -0700 Subject: [PATCH] go.tools/go/types: minor internal cleanup LGTM=adonovan R=adonovan CC=golang-codereviews https://golang.org/cl/80960046 --- go/types/typestring.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/go/types/typestring.go b/go/types/typestring.go index 7364a0fe..ad6a1d13 100644 --- a/go/types/typestring.go +++ b/go/types/typestring.go @@ -187,16 +187,14 @@ func writeType(buf *bytes.Buffer, this *Package, typ Type, visited []Type) { case *Named: s := "" if obj := t.obj; obj != nil { - if obj.pkg != nil { - if obj.pkg != this { - buf.WriteString(obj.pkg.path) - buf.WriteByte('.') - } - // TODO(gri): function-local named types should be displayed - // differently from named types at package level to avoid - // ambiguity. + if pkg := obj.pkg; pkg != nil && pkg != this { + buf.WriteString(pkg.path) + buf.WriteByte('.') } - s = t.obj.name + // TODO(gri): function-local named types should be displayed + // differently from named types at package level to avoid + // ambiguity. + s = obj.name } buf.WriteString(s)