[tools] go/analysis/passes/modernize: fix panic in stringscut

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jan 16, 2026, 2:38:18 PM (2 days ago) Jan 16
to Daniel Morsing, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Madeline Kalil, Go LUCI, Alan Donovan, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
go/analysis/passes/modernize: fix panic in stringscut

stringscut modernizer assumes that any CallExpr that occurs in the first
argument is a []byte(string) conversion, causing panics when given a
function call with no arguments at all.

Fixes golang/go#77208.
Change-Id: I17401c74c4681b24fb3a508cafafffee6a6a6964
Reviewed-by: Alan Donovan <adon...@google.com>
Reviewed-by: Madeline Kalil <mka...@google.com>
Auto-Submit: Alan Donovan <adon...@google.com>
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: S
Delta: 3 files changed, 21 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Alan Donovan, +2 by Madeline Kalil
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
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: master
Gerrit-Change-Id: I17401c74c4681b24fb3a508cafafffee6a6a6964
Gerrit-Change-Number: 737000
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Morsing <daniel....@gmail.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Daniel Morsing <daniel....@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages