mitchellh / mapstructure

Go library for decoding generic map values into native Go structures and vice versa.
https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
MIT License
7.93k stars 677 forks source link

prevent panic in TextUnmarshallerHookFunc #328

Closed prochac closed 11 months ago

prochac commented 1 year ago

if reflect.Kind is reflect.String, it doesn't necessary means it's string type. It can be string-based type

prochac commented 1 year ago

Fixes https://github.com/mitchellh/mapstructure/issues/327

prochac commented 1 year ago

It's very questionable if json.Number should be treated as string, and not as a number. But it's very handy for the given use-case from test, where json.Number can be parsed as big.Int

prochac commented 1 year ago

@mitchellh with all respect, does anyone helping you with PRs? There are many open with bug fixes that should be merged into upstream.

prochac commented 1 year ago

@mitchellh ping

chrisgacsal commented 1 year ago

@mitchellh Could you please take a look on this fix? Many thanks!

jkroepke commented 1 year ago

Thanks, it works for me.

@mitchellh I would appreciate this, if you could merge this.

prochac commented 11 months ago

@mitchellh Will this affect the future of this project?

https://www.theregister.com/2023/12/15/hashimoto_departs_hashicorp/

mitchellh commented 11 months ago

@mitchellh Will this affect the future of this project?

https://www.theregister.com/2023/12/15/hashimoto_departs_hashicorp/

Not specifically that.

As many here have probably noticed, I’ve barely been maintaining this project for years. That’s a mixture of a few things. One is that this project has worked well for my needs for a long time so there was no need to improve it for myself personally. Another is that I’ve been using Go less and less personally so I just haven’t been focused here. Etc. I plan on archiving this project sometime soon, and welcome any forks at this point…

sagikazarmark commented 11 months ago

@mitchellh We use mapstructure in Viper extensively. I'd be happy to maintain a fork. Even under a common place like https://github.com/go-viper if other people are interested in maintenance.

prochac commented 11 months ago

@sagikazarmark Terraform should show some personal interest in maintenance as well 😁 https://github.com/hashicorp/terraform/blob/654fd0041cac8f609e46af27be498aadf92aefe7/go.mod#L65-L73 Like OpenTofu 🙃 https://github.com/opentofu/opentofu/blob/5880b4964575b28d7272fa4a5c04afeef1bf0f3d/go.mod#L60-L68

With MIT license, anybody can create a fork. No need to transfer the project. FYI, here is a list of importers. Viper looks like a good umbrella. https://pkg.go.dev/github.com/mitchellh/mapstructure?tab=importedby