Closed suzuki-shunsuke closed 2 years ago
https://pkg.go.dev/reflect#Value.IsNil
The argument must be a chan, func, interface, map, pointer, or slice value; if it is not, IsNil panics.
I have sent a pull request to fix the issue. https://github.com/mitchellh/mapstructure/pull/265
I found the problem when I investigated the issue of Terraform AWS Provider.
ref. https://github.com/hashicorp/terraform-provider-aws/issues/22312#issuecomment-999566173
Panic occurs when an array is passed as Decode's input.
How to reproduce
You can reproduce the problem by passing an array as Decode's input.
https://go.dev/play/p/BMxes5mbumY
And you can fix the problem by changing the input type from array to slice.
https://go.dev/play/p/xrfz5X8RJis