-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
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
Error unmarshalling sync list
json
#358
Labels
Comments
xenoscopic
added a commit
that referenced
this issue
Aug 8, 2022
It turns out that the encoding/json package will only invoke UnmarshalText if the JSON value is a quoted string. Since we're dealing with boolean literals, we need to add an explicit UnmarshalJSON method, but we can still use UnmarshalText for the implementation. Fixes #358. Signed-off-by: Jacob Howard <jacob@mutagen.io>
xenoscopic
added a commit
that referenced
this issue
Aug 8, 2022
It turns out that the encoding/json package will only invoke UnmarshalText if the JSON value is a quoted string. Since we're dealing with boolean literals, we need to add an explicit UnmarshalJSON method, but we can still use UnmarshalText for the implementation. Fixes #358. Signed-off-by: Jacob Howard <jacob@mutagen.io>
xenoscopic
added a commit
that referenced
this issue
Aug 8, 2022
It turns out that the encoding/json package will only invoke UnmarshalText if the JSON value is a quoted string. Since we're dealing with boolean literals, we need to add an explicit UnmarshalJSON method, but we can still use UnmarshalText for the implementation. Fixes #358. Signed-off-by: Jacob Howard <jacob@mutagen.io>
This should be fixed with the v0.15.1 release. Let me know if the decoding issues persist. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using structs from here: https://github.com/mutagen-io/mutagen/tree/v0.15.0/pkg/api/models (specifically the
Session
struct) I was attempting to unmarshall the results of callingmutagen sync list --format "{{ json . }}"
.I received error
json: cannot unmarshal bool into Go struct field .ignore.vcs of type core.IgnoreVCSMode
Here's the info and steps to reproduce:
0.15.0
json returned gives true or false but this struct wants an int32 with values 0, 1, or 2 (looks like it’s protobuf-generated object)
10:25
Lastly, from our quick Slack convo:
The text was updated successfully, but these errors were encountered: