[tools/internal-branch.go1.27-vendor] [internal-branch.go1.27-vendor] go/analysis/passes/modernize: use isScalarLvalue in stringscut modernizer

0 views
Skip to first unread message

Carlos Amedee (Gerrit)

unread,
Jul 24, 2026, 3:35:28 PM (2 days ago) Jul 24
to Madeline Kalil, Mateusz Poliwczak, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Alan Donovan, golang-co...@googlegroups.com

Carlos Amedee submitted the change

Change information

Commit message:
[internal-branch.go1.27-vendor] go/analysis/passes/modernize: use isScalarLvalue in stringscut modernizer

Fixes few issues in the existing hasModifyingUses:

- missed unparen enclosing
- missed range stmt handling
- skipping based on position is invalid, since variables can
be captured in a closure.

Change-Id: I6094b0114734ca90170001dba2477cac6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/tools/+/770720
Reviewed-by: Alan Donovan <adon...@google.com>
Auto-Submit: Mateusz Poliwczak <mpoliw...@gmail.com>
Reviewed-by: Madeline Kalil <mka...@google.com>
LUCI-TryBot-Result: golang...@luci-project-accounts.iam.gserviceaccount.com <golang...@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 33eb337f9633cf3e04208b79577180b09c662a15)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/805322
Files:
  • M go/analysis/passes/modernize/stringscut.go
  • M go/analysis/passes/modernize/testdata/src/stringscut/stringscut.go
  • M go/analysis/passes/modernize/testdata/src/stringscut/stringscut.go.golden
Change size: M
Delta: 3 files changed, 142 insertions(+), 35 deletions(-)
Branch: refs/heads/internal-branch.go1.27-vendor
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: internal-branch.go1.27-vendor
Gerrit-Change-Id: I6094b0114734ca90170001dba2477cac6a6a6964
Gerrit-Change-Number: 805322
Gerrit-PatchSet: 2
Gerrit-Owner: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Carlos Amedee <car...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-CC: Mateusz Poliwczak <mpoliw...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages