-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
enhancementNew feature or improvementNew feature or improvementlinter: ideaidea of a linteridea of a linter
Description
Your feature request related to a problem? Please describe.
I've run into runtime bugs when adding a new field to a "service-like" struct (a FooService or something like that), but then I find out someone's instantiating the struct without a constructor so some code somewhere breaks at runtime because of a nil pointer!
Describe the solution you'd like.
I'd love to see two linters created:
structs that should have a ctor, which don't have a ctorstructs that do have a ctor, but which are instantiated without using the ctor
These linters would definitely want to take regexes that specify the types of structs that we consider to be lintable -- most structs don't have this problem since they're just data and we really don't even want a ctor for them.
Describe alternatives you've considered.
Pray our tests catch this stuff! 🙏
Additional context.
I've written these linters already (and they're useful for me), but I didn't want to create a PR without gauging interest first.
I'm new to this project, so thanks for your patience!
MDanialSaleem
Metadata
Metadata
Assignees
Labels
enhancementNew feature or improvementNew feature or improvementlinter: ideaidea of a linteridea of a linter