Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: package type name collision with built-in types in compiler error messages #8983
v1.3.3 Thread on go-nuts: https://groups.google.com/forum/#!topic/golang-nuts/Ed3gU3EjbaI Problem: When you define a package level "error" type (lower-case) it shadows the built-in error type and causes error messages like: > Cannot use errors.New("something wrong") (type error) as type error in return argument Solutions proposed: Maybe the type name could be shown as "built in type error" in error messages, and the same for "built in type int". Or, on the other hand, maybe the locally defined type should be shown as "type foo.error" where foo is the package name in which it is defined. And then, why not both? That would make all error messages redundantly unambiguous. We've tried very hard to keep error messages concise. Perhaps we could just add the context where there is ambiguity.