ldez / tagliatelle

A linter that handles struct tags.
Apache License 2.0
47 stars 9 forks source link

Ignore struct fields with `inline` tag flag #9

Closed silverlyra closed 2 years ago

silverlyra commented 2 years ago

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'
ldez commented 2 years ago

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 commented 2 years ago

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

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

ldez commented 2 years ago

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.