Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: go/ast/astutil/imports.go
Insertions: 2, Deletions: 2.
@@ -473,7 +473,7 @@
}
// setBasicLitValuePos updates lit.Pos,
-// ensuring that lit.End is displaced by the same amount.
+// ensuring that lit.End (if set) is displaced by the same amount.
// (See https://go.dev/issue/76395.)
func updateBasicLitPos(lit *ast.BasicLit, pos token.Pos) {
len := lit.End() - lit.Pos()
@@ -481,7 +481,7 @@
// TODO(adonovan): after go1.26, simplify to:
// lit.ValueEnd = pos + len
v := reflect.ValueOf(lit).Elem().FieldByName("ValueEnd")
- if v.IsValid() {
+ if v.IsValid() && v.Int() != 0 {
v.SetInt(int64(pos + len))
}
}
```
Change information
Commit message:
go/ast/astutil: update BasicLit.ValueEnd if present
This is a putative fix; I haven't been able to reproduce
the problem locally yet.
Fixes golang/go#76395
For golang/go#76031
Change-Id: I2fe3d96e60629fd360563021e42acc5b248d7ff2
Files:
- M go/ast/astutil/imports.go
- M internal/imports/sortimports.go
Change size: S
Delta: 2 files changed, 36 insertions(+), 6 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Robert Findley
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI