What version of Go are you using (go version)?
go version go1.15.2 darwin/amd64
What did you do?
I tried to compile the following program: https://play.golang.org/p/k1xIda2_lTk
package main
type Struct struct {
Slice []int
}
func main() {
var x *Struct
if x == nil || len(x.Slice) {
}
}
I forgot to add len(x.Slice) == 0.
What did you expect to see?
non-bool len(x.Slice) (type int) used as if condition
What did you see instead?
cannot use x == nil (type untyped bool) as type int
What version of Go are you using (
go version)?go version go1.15.2 darwin/amd64
What did you do?
I tried to compile the following program: https://play.golang.org/p/k1xIda2_lTk
I forgot to add
len(x.Slice) == 0.What did you expect to see?
What did you see instead?