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

Ignore struct fields with inline tag flag #9

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

silverlyra
Copy link
Contributor

Fixes #8.

Updated the test file to include a json:",inline" field. Without the fix, that file fails with:

=== RUN   TestAnalyzer
    analysistest.go:446: a/sample.go:10:14: unexpected diagnostic: json(camel): got 'Quux' want 'quux'

tagliatelle.go Show resolved Hide resolved
@ldez
Copy link
Owner

ldez commented Jan 25, 2022

analysistest.go:446: a/sample.go:10:14: unexpected diagnostic: json(camel): got 'Quux' want 'quux'

This is the expected behavior as you can see here

@ldez
Copy link
Owner

ldez commented Jan 25, 2022

🤔 the yaml parser doesn't have the same behavior as json with inline.

https://go.dev/play/p/0_GnAfICLTu

Copy link
Owner

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge PR in the current state, but I will change the behavior in the next commit.
Because Quux Quux `json:",inline"` must fail:

@ldez ldez merged commit c13286c into ldez:master Jan 25, 2022
@ldez
Copy link
Owner

ldez commented Jan 25, 2022

In fact, I cannot change the behavior because yaml parser is able to read json tags...

I'm not happy with the current solution but, for now, I don't see any better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tagliatelle now warns on inline struct fields
2 participants