-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
tagliatelle: issue with invalid struct #11
Comments
I worked on a fix, I'm about to publish. |
Hello, the goal of tagliatelle is not to validate the syntax of struct tags, there are already existing linters to manage that. |
I agree with you, but it failed to validate an issue with the following code (example)
For me this, this is a legitimate use cases, in this example json:"mixe" is wrong, if you consider the purpose of tagliatelle. tagliatelle may not return information about what the problem is, but I think it should at least report, it cannot analyze the tag. Because otherwise, it reports there is no problem at all with such a structure |
In your example, tagliatelle will find the problem with JSON tag.
type Mixed struct{}
type Foo struct {
Mixed `json:"mixe" yaml:"mixed`
} Note: in this case, the tag But in the following example, the struct tag will be "ignored": type Mixed struct{}
type Foo struct {
Mixed `json:"mixe`
} |
The reflect API doesn't allow us to see a difference between a missing tag or a malformed tag. |
FYI, this linter has been created mainly to be used inside golangci-lint. In golangci-lint, you can enable the go vet pass called |
Yes, I use it locally via golang-ci, also tagliatelle. It's just that I installed tagliatelle directly, and failed to detect something, while doing my tests. I agree with you and the need to keep your linter simple, so I will close this MR, and the issue, but I will open a new MR to document tagliatelle is not about validating struct, and that structtag is the perfect candidate to do that. |
Tagliatelle is unable to detect issue with invalid tags
The text was updated successfully, but these errors were encountered: