-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Open
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.
Milestone
Description
Go version
go version go1.26.0 darwin/arm64
Output of go env in your module/workspace:
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/dhaus/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/dhaus/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/qj/s291ss6d6zx9456ns0f163yr0000gn/T/go-build242663847=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/dhaus/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/dhaus/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.26.0/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/dhaus/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.26.0/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.26.0'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
package main
import "fmt"
func Bar[T any](f func(interface{ Baz() T }) T) {
// No-op
}
func Foo[T any]() {
// Pass the method expression of an anonymous generic interface.
Bar(interface{ Baz() T }.Baz)
}
func main() {
fmt.Printf("Import printf for analyzer...\n")
Foo[int]()
}What did you see happen?
When running either go vet (or go test since it runs go vet as well), the prinf analyzer panics:
go vet main.go
command-line-arguments
# [command-line-arguments]
panic: (*ast.InterfaceType) 0x27d3a6cdfde8
goroutine 27 [running]:
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).expr(0x27d3a6b16510, {0x1006dd830, 0x27d3a6cdfde8})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:492 +0xa74
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).expr(0x27d3a6b16510, {0x1006dd3e0, 0x27d3a6cdfe00})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:401 +0x3d4
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).call(0x27d3a6b16510, 0x27d3a6d84180, {0x27d3a6a7f580, 0x1, 0x0?})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:180 +0x3b8
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).expr(0x27d3a6b16510, {0x1006dd290, 0x27d3a6cf74c0})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:466 +0x994
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0x27d3a6b16510, {0x1006dd530?, 0x27d3a6a7f5a0})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:521 +0x9c
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).stmt(0x27d3a6b16510, {0x1006dd650?, 0x27d3a6d0c390})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:592 +0x7e4
cmd/vendor/golang.org/x/tools/refactor/satisfy.(*Finder).Find(0x27d3a6b16510, 0x27d3a6aebb60?, {0x27d3a6a52528, 0x1, 0x27d3a6b16450?})
cmd/vendor/golang.org/x/tools/refactor/satisfy/find.go:108 +0x190
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.methodImplementations(0x27d3a6b18460)
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go:387 +0x64
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.findPrintLike(0x27d3a6b18460, 0x27d3a6b02028)
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go:293 +0x180
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.run(0x27d3a6b18460)
cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go:118 +0x64
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func2.1()
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:487 +0x7cc
sync.(*Once).doSlow(0x10067d8c0?, 0x27d3a6d831d0?)
sync/once.go:78 +0xdc
sync.(*Once).Do(...)
sync/once.go:69
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func2(0x1007c3000)
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:421 +0xec
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func3.1(0x0?)
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:509 +0x2c
created by cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.run.func3 in goroutine 1
cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go:508 +0x48
What did you expect to see?
The anonymous interface expression shouldn't yield a panic.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.