Closed
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:
struct
s that should have a ctor, which don't have a ctorstruct
s 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 struct
s 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!