-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add propro linter #6236
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
base: main
Are you sure you want to change the base?
Add propro linter #6236
Conversation
|
Hey, thank you for opening your first Pull Request ! |
|
In order for a pull request adding a linter to be reviewed, the linter and the PR must follow some requirements.
Pull Request Description
Base RequirementsThese requirements are not declarative; the team will verify them.
Linter
The Linter Tests Inside Golangci-lint
|
propro is an abbreviation of Protected Properties. It prevents direct writes to public/exported struct properties.
Why propro?
ORMs like GORM, or JSON needs to access public/exported fields of structs it works with. Therefore, developers use mapping entities with private properties to model structs which contain public properties. However, this approach has drawbacks: it introduces a lot of boilerplate code because it requires writing and maintaining mapping logic for both directions, and adds extra unit tests for those mappings.
propro solves this problem at the linter level by blocking direct writes to public fields of protected structs.
This allows entities to keep exported fields and be used directly with GORM and JSON—without all the mapping boilerplate.
More info here: https://github.com/digitalstraw/propro