Skip to content

Commit 267b50a

Browse files
committed
Revert "go/printer: reuse go/token.FileSet.PositionFor calls in setPos"
This reverts commit http://go.dev/cl/461739 Reason for revert: Causes longtest failures due to odd formatting. Change-Id: I7e31ff107e730b6d667866ea7718bc8632760422 Reviewed-on: https://go-review.googlesource.com/c/go/+/483676 Reviewed-by: Russ Cox <[email protected]> Run-TryBot: Than McIntosh <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent e78871e commit 267b50a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/go/printer/printer.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -878,12 +878,8 @@ func mayCombine(prev token.Token, next byte) (b bool) {
878878
}
879879

880880
func (p *printer) setPos(pos token.Pos) {
881-
// If p.pos is already equivalent to pos,
882-
// we can avoid calling posFor again.
883881
if pos.IsValid() {
884-
if file := p.fset.File(pos); file != nil && file.Offset(pos) != p.pos.Offset {
885-
p.pos = p.posFor(pos) // accurate position of next item
886-
}
882+
p.pos = p.posFor(pos) // accurate position of next item
887883
}
888884
}
889885

0 commit comments

Comments
 (0)