aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cmd/compile/internal/gc/subr.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index 2bbc5e4ae1..6df9ffc66e 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -60,9 +60,15 @@ func adderrorname(n *Node) {
}
func adderr(pos src.XPos, format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ // Only add the position if we have a file.
+ // See issue golang.org/issue/11361.
+ if !strings.HasSuffix(msg, ": no such file or directory") && !strings.HasSuffix(msg, ": permission denied") {
+ msg = fmt.Sprintf("%v: %s", linestr(pos), msg)
+ }
errors = append(errors, Error{
pos: pos,
- msg: fmt.Sprintf("%v: %s\n", linestr(pos), fmt.Sprintf(format, args...)),
+ msg: msg + "\n",
})
}