Go version
go version go1.24.2 linux/amd64
Output of go env
in your module/workspace:
N/A
What did you do?
This like #57160, but with func
instead of pointers:
package p
func _() {
if foo < bar {
}
}
func foo() {}
const bar = 0
What did you see happen?
./main.go:4:11: cannot convert bar (untyped int constant 0) to type func()
But even if you could convert it to func(), it's not comparable with <
What did you expect to see?
Like go 1.17:
./main.go:4:9: invalid operation: foo < bar (mismatched types func() int and int)
Comment From: gabyhelp
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: prattmic
cc @golang/compiler
Comment From: gopherbot
Change https://go.dev/cl/682495 mentions this issue: go/types, types2: better error messages for certain type mismatches