Closed hujun-open closed 3 months ago
This is a duplicate of #122 . See @deckarep's comment https://github.com/deckarep/golang-set/issues/122#issuecomment-1872382278 for a full explanation of why this is currently happening, but the short story is that the UnmarshalJSON
function is not defined on the set with a pointer receiver.
As a workaround for now you can add s2.MapSet = mapset.NewSet[string]()
after you declare s2
and it seems to work as you can see here: https://go.dev/play/p/NQcs2bSLCR2.
That's not ideal, but it will work for now until the open questions in #122 are resolved.
ok, thanks, the workaround works; though it would be nicer to fix this
it seems json umarshal fails when Set is part of struct, following code produces following error. not sure what did I miss here
I am using
github.com/deckarep/golang-set/v2 v2.6.0
and go v1.22.1code: