all: fix function name mismatch in updateBasicLitPos comment

Change-Id: I7735670b5f58cf661b5005ef6287ec696ebb3f9a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/727601
Auto-Submit: Alan Donovan <adonovan@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/go/ast/astutil/imports.go b/go/ast/astutil/imports.go
index e2790ce..adb4711 100644
--- a/go/ast/astutil/imports.go
+++ b/go/ast/astutil/imports.go
@@ -472,7 +472,7 @@
 	return groups
 }
 
-// setBasicLitValuePos updates lit.Pos,
+// updateBasicLitPos updates lit.Pos,
 // 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) {
diff --git a/internal/imports/sortimports.go b/internal/imports/sortimports.go
index a09d95f..f390be9 100644
--- a/internal/imports/sortimports.go
+++ b/internal/imports/sortimports.go
@@ -298,8 +298,8 @@
 func (x byCommentPos) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }
 func (x byCommentPos) Less(i, j int) bool { return x[i].Pos() < x[j].Pos() }
 
-// setBasicLitValuePos updates lit.Pos,
-// ensuring that lit.End is displaced by the same amount.
+// updateBasicLitPos updates lit.Pos,
+// 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()
@@ -307,7 +307,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))
 	}
 }