diff options
Diffstat (limited to 'src/pkg/go/scanner/errors.go')
-rw-r--r-- | src/pkg/go/scanner/errors.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/pkg/go/scanner/errors.go b/src/pkg/go/scanner/errors.go index 54770f020..fde211216 100644 --- a/src/pkg/go/scanner/errors.go +++ b/src/pkg/go/scanner/errors.go @@ -69,17 +69,12 @@ type Error struct { func (e *Error) String() string { - s := e.Pos.Filename; - if s != "" { - s += ":"; + if e.Pos.Filename != "" || e.Pos.IsValid() { + // don't print "<unknown position>" + // TODO(gri) reconsider the semantics of Position.IsValid + return e.Pos.String() + ": " + e.Msg; } - if e.Pos.IsValid() { - s += fmt.Sprintf("%d:%d:", e.Pos.Line, e.Pos.Column); - } - if s != "" { - s += " "; - } - return s + e.Msg; + return e.Msg; } |