We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The simplest way I can re-do it is below. It causes a panic [1]
package main import ( "fmt" "github.com/mitchellh/mapstructure" ) type Foo struct { B [2][]byte } func main() { f := &Foo{} if err := mapstructure.Decode(map[string]interface{}{"B": [2][]byte{{1, 2}, {3, 4}}}, &f); err != nil { panic(err) } fmt.Println(f.B) }
[1]
panic: runtime error: comparing uncomparable type [2][]uint8 goroutine 1 [running]: github.com/mitchellh/mapstructure.(*Decoder).decodeArray(0x1400006e1f8, {0x1012344ac, 0x1}, {0x10129cfe0, 0x14000421d10}, {0x10129cfe0?, 0x14000421cb0?, 0x1009eff8c?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:1164 +0x1f8 github.com/mitchellh/mapstructure.(*Decoder).decode(0x1400006e1f8, {0x1012344ac, 0x1}, {0x10129cfe0?, 0x14000421d10?}, {0x10129cfe0?, 0x14000421cb0?, 0x10095c388?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:490 +0x1b8 github.com/mitchellh/mapstructure.(*Decoder).decodeStructFromMap(0x1400006e1f8, {0x0, 0x0}, {0x1012c7380?, 0x14000421ce0?, 0x100964b10?}, {0x1012e9e80?, 0x14000421cb0?, 0x140005cdb18?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:1411 +0x718 github.com/mitchellh/mapstructure.(*Decoder).decodeStruct(0x140005cdc48?, {0x0, 0x0}, {0x1012c7380?, 0x14000421ce0?}, {0x1012e9e80?, 0x14000421cb0?, 0x6050f655bb53ef15?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:1235 +0x3ec github.com/mitchellh/mapstructure.(*Decoder).decode(0x1400006e1f8, {0x0, 0x0}, {0x1012c7380?, 0x14000421ce0?}, {0x1012e9e80?, 0x14000421cb0?, 0x100964b10?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:482 +0x218 github.com/mitchellh/mapstructure.(*Decoder).decodePtr(0x1400006e1f8, {0x0, 0x0}, {0x1012c7380, 0x14000421ce0}, {0x101270c40?, 0x1400006e1e8?, 0x101b84130?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:1052 +0x3b8 github.com/mitchellh/mapstructure.(*Decoder).decode(0x1400006e1f8, {0x0, 0x0}, {0x1012c7380?, 0x14000421ce0?}, {0x101270c40?, 0x1400006e1e8?, 0x10138a120?}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:486 +0x1e8 github.com/mitchellh/mapstructure.(*Decoder).Decode(0x1400006e1f8, {0x1012c7380, 0x14000421ce0}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:417 +0xb8 github.com/mitchellh/mapstructure.Decode({0x1012c7380, 0x14000421ce0}, {0x101280080?, 0x1400006e1e8}) <user>//go/pkg/mod/github.com/mitchellh/mapstructure@v1.5.0/mapstructure.go:317 +0x8c main.main() <user>//go/src/playground/entry.go:14 +0x144
The text was updated successfully, but these errors were encountered:
Fix mitchellhGH-340: Decoding array of slices causes panic
50da267
1dfe25f
58a4c3b
No branches or pull requests
The simplest way I can re-do it is below. It causes a panic [1]
[1]
The text was updated successfully, but these errors were encountered: