From: Rob Findley Date: Mon, 17 May 2021 20:11:51 +0000 (-0400) Subject: go/token: correct the interval notation used in some panic messages X-Git-Tag: go1.17beta1~142 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bfe3573d58d7c49c4d58e0ab392eb0b5a660d262;p=gostls13.git go/token: correct the interval notation used in some panic messages Fix an apparent typo for the right-hand bound in a couple panic messages, where '[' was used instead of ']'. Fixes #46215 Change-Id: Ie419c404ca72ed085a83a2c38ea1a5d6ed326cca Reviewed-on: https://go-review.googlesource.com/c/go/+/320510 Trust: Robert Findley Trust: Robert Griesemer Run-TryBot: Robert Findley TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- diff --git a/src/go/token/position.go b/src/go/token/position.go index bbcd8b022b..0d7982c670 100644 --- a/src/go/token/position.go +++ b/src/go/token/position.go @@ -278,7 +278,7 @@ func (f *File) Pos(offset int) Pos { // func (f *File) Offset(p Pos) int { if int(p) < f.base || int(p) > f.base+f.size { - panic(fmt.Sprintf("invalid Pos value %d (should be in [%d, %d[)", p, f.base, f.base+f.size)) + panic(fmt.Sprintf("invalid Pos value %d (should be in [%d, %d])", p, f.base, f.base+f.size)) } return int(p) - f.base } @@ -346,7 +346,7 @@ func (f *File) position(p Pos, adjusted bool) (pos Position) { func (f *File) PositionFor(p Pos, adjusted bool) (pos Position) { if p != NoPos { if int(p) < f.base || int(p) > f.base+f.size { - panic(fmt.Sprintf("invalid Pos value %d (should be in [%d, %d[)", p, f.base, f.base+f.size)) + panic(fmt.Sprintf("invalid Pos value %d (should be in [%d, %d])", p, f.base, f.base+f.size)) } pos = f.position(p, adjusted) }