1
0
mirror of https://github.com/golang/go synced 2024-11-19 01:04:40 -07:00

go.tools/go/types: use unqualified names for local objects in error messages

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/77590043
This commit is contained in:
Robert Griesemer 2014-03-18 13:37:09 -07:00
parent 5893c271ff
commit 62216e60bb

View File

@ -27,16 +27,19 @@ func (check *checker) sprintf(format string, args ...interface{}) string {
for i, arg := range args {
switch a := arg.(type) {
case nil:
args[i] = "<nil>"
arg = "<nil>"
case operand:
panic("internal error: should always pass *operand")
case token.Pos:
args[i] = check.fset.Position(a).String()
arg = check.fset.Position(a).String()
case ast.Expr:
args[i] = ExprString(a)
arg = ExprString(a)
case Object:
arg = ObjectString(check.pkg, a)
case Type:
args[i] = TypeString(check.pkg, a)
arg = TypeString(check.pkg, a)
}
args[i] = arg
}
return fmt.Sprintf(format, args...)
}