-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add custom structfield linter to check struct field names and tags #3843
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
Add custom structfield linter to check struct field names and tags #3843
Conversation
3660e2f to
fd07588
Compare
fd07588 to
e7e528b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3843 +/- ##
=======================================
Coverage 92.41% 92.42%
=======================================
Files 197 197
Lines 14152 14167 +15
=======================================
+ Hits 13079 13094 +15
Misses 884 884
Partials 189 189 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Thank you, @alexandear!
Just a couple questions, really.
gmlewis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @alexandear!
LGTM.
Merging.
This PR renames
jsonfieldnamelinter tostructfieldand extends it to check struct tags.The linter enforces that:
jsonandurlmatch the struct field namejsonandurltags that includeomitemptymust use pointers types, except for slices, maps,json.RawMessage, andany.Example output for the
ListCursorOptionsstruct:go-github/github/github.go
Lines 262 to 267 in 671b8b0
Closes #3775