[tools] go/analysis/passes/printf: panic when function literal is assigned to the blank identifier

1 view
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Nov 28, 2025, 5:10:41 PM (2 days ago) Nov 28
to Oliver Eikemeier, Gerrit Bot, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alan Donovan, Go LUCI, Dmitri Shuralyov, Dmitri Shuralyov, Michael Matloob, Robert Findley, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
go/analysis/passes/printf: panic when function literal is assigned to the blank identifier

the printf analyzer fails on

func _() {
_ = func() {}
}

info.ObjectOf returns nil for the blank identifier ('_'),
which fails the type assertion to *types.Var.

Fixes golang/go#76616
Change-Id: I045c2dd55f92c398614e4e4f90ceeed5718265d2
GitHub-Last-Rev: d8027045c24872975e3921af9b1f2824a0c9c7ec
GitHub-Pull-Request: golang/tools#607
Reviewed-by: Alan Donovan <adon...@google.com>
Auto-Submit: Dmitri Shuralyov <dmit...@google.com>
Commit-Queue: Alan Donovan <adon...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Auto-Submit: Alan Donovan <adon...@google.com>
Files:
  • M go/analysis/passes/printf/printf.go
  • M go/analysis/passes/printf/printf_test.go
  • A go/analysis/passes/printf/testdata/src/issue76616/issue76616.go
Change size: XS
Delta: 3 files changed, 7 insertions(+), 2 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Alan Donovan, +1 by Dmitri Shuralyov
  • 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: I045c2dd55f92c398614e4e4f90ceeed5718265d2
Gerrit-Change-Number: 725060
Gerrit-PatchSet: 4
Gerrit-Owner: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-CC: Michael Matloob <mat...@golang.org>
Gerrit-CC: Oliver Eikemeier <eike...@fillmore-labs.com>
Gerrit-CC: Robert Findley <rfin...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages