diff options
author | Russ Cox <rsc@golang.org> | 2009-10-06 19:41:51 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-10-06 19:41:51 -0700 |
commit | 6c2652e6fd54ce34ca3be95540c54cebb52bfece (patch) | |
tree | 2366cc62ab4dee2e5698d6d6e5b299d6819a7edd /src/pkg/go/scanner/errors.go | |
parent | db62e99a735a036afda2098f1a721fe8dbf6ce76 (diff) | |
download | golang-6c2652e6fd54ce34ca3be95540c54cebb52bfece.tar.gz |
apply gofmt to go, gob, hash, http, image, io, json, log
R=gri
DELTA=1359 (138 added, 32 deleted, 1189 changed)
OCL=35408
CL=35420
Diffstat (limited to 'src/pkg/go/scanner/errors.go')
-rw-r--r-- | src/pkg/go/scanner/errors.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/pkg/go/scanner/errors.go b/src/pkg/go/scanner/errors.go index fde211216..73429f1fa 100644 --- a/src/pkg/go/scanner/errors.go +++ b/src/pkg/go/scanner/errors.go @@ -63,8 +63,8 @@ func (h *ErrorVector) ErrorCount() int { // token, and the error condition is described by Msg. // type Error struct { - Pos token.Position; - Msg string; + Pos token.Position; + Msg string; } @@ -83,11 +83,15 @@ type ErrorList []*Error // ErrorList implements the SortInterface. -func (p ErrorList) Len() int { return len(p); } -func (p ErrorList) Swap(i, j int) { p[i], p[j] = p[j], p[i]; } +func (p ErrorList) Len() int { + return len(p); +} +func (p ErrorList) Swap(i, j int) { + p[i], p[j] = p[j], p[i]; +} -func (p ErrorList) Less(i, j int) bool { +func (p ErrorList) Less(i, j int) bool { e := &p[i].Pos; f := &p[j].Pos; // Note that it is not sufficient to simply compare file offsets because @@ -115,7 +119,7 @@ func (p ErrorList) String() string { case 1: return p[0].String(); } - return fmt.Sprintf("%s (and %d more errors)", p[0].String(), len(p) - 1); + return fmt.Sprintf("%s (and %d more errors)", p[0].String(), len(p)-1); } @@ -123,9 +127,9 @@ func (p ErrorList) String() string { // returned by GetErrors. // const ( - Raw = iota; // leave error list unchanged - Sorted; // sort error list by file, line, and column number - NoMultiples; // sort error list and leave only the first error per line + Raw = iota; // leave error list unchanged + Sorted; // sort error list by file, line, and column number + NoMultiples; // sort error list and leave only the first error per line ) @@ -148,7 +152,7 @@ func (h *ErrorVector) GetErrorList(mode int) ErrorList { } if mode >= NoMultiples { - var last token.Position; // initial last.Line is != any legal error line + var last token.Position; // initial last.Line is != any legal error line i := 0; for _, e := range list { if e.Pos.Filename != last.Filename || e.Pos.Line != last.Line { @@ -157,7 +161,7 @@ func (h *ErrorVector) GetErrorList(mode int) ErrorList { i++; } } - list = list[0 : i]; + list = list[0:i]; } return list; |