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

Do not complain about structs which implement json.Marshaler #64

Closed
mitar opened this issue Aug 23, 2023 · 4 comments · Fixed by #67
Closed

Do not complain about structs which implement json.Marshaler #64

mitar opened this issue Aug 23, 2023 · 4 comments · Fixed by #67
Labels
bug Something isn't working

Comments

@mitar
Copy link

mitar commented Aug 23, 2023

I have a struct which implements json.Marshaler interface by implementing MarshalJSON method on the struct, but this linter complains that I should define struct tags? Why? MarshalJSON does not need/use them.

@tmzane
Copy link
Member

tmzane commented Aug 23, 2023

Good catch 👍

This corner case is indeed not covered at the moment.

@tmzane tmzane added the bug Something isn't working label Aug 23, 2023
@scop
Copy link

scop commented Oct 3, 2023

For completeness/maybe self evident, but unmarshaling should be handled similarly.

@tmzane
Copy link
Member

tmzane commented Oct 3, 2023

I completely forgot about this one 😅 Will publish a fix in a few days.

@tmzane
Copy link
Member

tmzane commented Oct 8, 2023

I've added support for all the interfaces from json, xml, yaml and toml, your case should be covered now.

Currently, it only works for the value semantics implementations (e.g. func (Foo) MarshalJSON() ...), I'm going to add pointer semantics support after I do some refactoring.

Thank you for the report!

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