mirror of
https://github.com/golang/go
synced 2024-11-12 00:20:22 -07:00
more useful error string
R=r DELTA=5 (4 added, 0 deleted, 1 changed) OCL=29088 CL=29090
This commit is contained in:
parent
02f13e4764
commit
1b3b51f7db
@ -50,7 +50,11 @@ func (p ErrorList) Less(i, j int) bool { return p[i].Pos.Offset < p[j].Pos.Offs
|
|||||||
|
|
||||||
|
|
||||||
func (p ErrorList) String() string {
|
func (p ErrorList) String() string {
|
||||||
return fmt.Sprintf("%d syntax errors", len(p));
|
switch len(p) {
|
||||||
|
case 0: return "unspecified error";
|
||||||
|
case 1: return p[0].String();
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s (and %d more errors)", p[0].String(), len(p) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user