mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
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 <rfindley@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
a2c07a9a1a
commit
bfe3573d58
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue