From 267b50a8349790afaff6649b719331fc89ef8825 Mon Sep 17 00:00:00 2001 From: Than McIntosh Date: Tue, 11 Apr 2023 14:15:36 +0000 Subject: [PATCH] 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 Run-TryBot: Than McIntosh TryBot-Result: Gopher Robot --- src/go/printer/printer.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/go/printer/printer.go b/src/go/printer/printer.go index c90791556e..741e3f782c 100644 --- a/src/go/printer/printer.go +++ b/src/go/printer/printer.go @@ -878,12 +878,8 @@ func mayCombine(prev token.Token, next byte) (b bool) { } func (p *printer) setPos(pos token.Pos) { - // If p.pos is already equivalent to pos, - // we can avoid calling posFor again. if pos.IsValid() { - if file := p.fset.File(pos); file != nil && file.Offset(pos) != p.pos.Offset { - p.pos = p.posFor(pos) // accurate position of next item - } + p.pos = p.posFor(pos) // accurate position of next item } } -- 2.48.1