Skip to content
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

tg.Config: load: unmarshal: json: cannot unmarshal object into Go struct field #885

Closed
iyear opened this issue Sep 21, 2022 · 3 comments · Fixed by #886
Closed

tg.Config: load: unmarshal: json: cannot unmarshal object into Go struct field #885

iyear opened this issue Sep 21, 2022 · 3 comments · Fixed by #886
Labels
bug Something isn't working

Comments

@iyear
Copy link
Contributor

iyear commented Sep 21, 2022

What version of gotd are you using?

v0.69.1-0.20220919134912-f8b8bd891200

Can this issue be reproduced with the latest version?

Yes

What did you do?

run the client repeatedly

What did you expect to see?

It runs successfully.

What did you see instead?

2022-09-21T09:24:33.320+0800	INFO	client.conn.mtproto.rpc	rpc/engine.go:42	Initialized	{"v": "v0.69.1-0.20220919134912-f8b8bd891200", "conn_id": 0, "dc_id": 2, "retry_interval": "1s", "max_retries": 10}
2022-09-21T09:24:33.320+0800	INFO	client	telegram/connect.go:114	Starting	{"v": "v0.69.1-0.20220919134912-f8b8bd891200"}
2022-09-21T09:24:33.321+0800	INFO	client	telegram/connect.go:131	Closed	{"v": "v0.69.1-0.20220919134912-f8b8bd891200"}
load: unmarshal: json: cannot unmarshal object into Go struct field Config.Data.Config.ReactionsDefault of type tg.ReactionClass

After #880, tg.Config has added a ReactionDefault interface type that cannot be parsed to go struct when json unmarshal.

What Go version and environment are you using?

v1.18.5

@iyear iyear added the bug Something isn't working label Sep 21, 2022
@iyear
Copy link
Contributor Author

iyear commented Sep 21, 2022

The best way to accommodate future layer updates is to use bin.Encode/bin.Decode, but this will cause a breaking update and all logged-in clients will have to login again

@luk0y
Copy link
Contributor

luk0y commented Sep 24, 2022

Any workaround for this or maybe I should stick to a different gotd version?

@f8lft
Copy link

f8lft commented Sep 25, 2022

It tries to deserialize to the interface. The standard json marshaller doesn't know which reaction class to use as there is no mapping at all.

Any workaround for this or maybe I should stick to a different gotd version?

The fast workaround is to implement the custom session.Storage in order to properly deserialize this field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants