Closed mibk closed 6 years ago
This program
package main import ( "database/sql" "github.com/go-test/deep" ) type NullString struct{ sql.NullString } func main() { a := map[string]interface{}{ "a": NullString{sql.NullString{"foo", true}}, } b := map[string]interface{}{ "a": sql.NullString{"foo", true}, } deep.Equal(b, a) }
panics with
panic: reflect: Field index out of range goroutine 1 [running]: reflect.Value.Field(0x10e1880, 0xc42000a060, 0x99, 0x1, 0x10d1a60, 0xc42000a090, 0x81) /usr/local/Cellar/go/1.9.2/libexec/src/reflect/value.go:769 +0x14c github.com/go-test/deep.(*cmp).equals(0xc42003de98, 0x10db460, 0xc42000e2c0, 0x94, 0x10db460, 0xc42000e2d0, 0x94, 0x1) /Users/mibk/src/github.com/go-test/deep/deep.go:179 +0x648 github.com/go-test/deep.(*cmp).equals(0xc42003de98, 0x10dd240, 0xc4200721e0, 0x15, 0x10dd240, 0xc4200721b0, 0x15, 0x0) /Users/mibk/src/github.com/go-test/deep/deep.go:225 +0x1810 github.com/go-test/deep.Equal(0x10dd240, 0xc4200721e0, 0x10dd240, 0xc4200721b0, 0xc4200801a8, 0xc42003df70, 0x1004324) /Users/mibk/src/github.com/go-test/deep/deep.go:77 +0x284 main.main() /Users/mibk/src/github.com/mibk/junk/deep/main.go:18 +0x211 exit status 2
Note that if I flip the arguments (deep.Equal(a, b)), the program works just fine.
deep.Equal(a, b)
go version go1.9.2 darwin/amd64 GOARCH="amd64" GOOS="darwin"
This was appears to be fixed by https://github.com/go-test/deep/pull/7
This program
panics with
Note that if I flip the arguments (
deep.Equal(a, b)
), the program works just fine.