-
Notifications
You must be signed in to change notification settings - Fork 2
85 enable golang ci lint and errcheck linter #88
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
85 enable golang ci lint and errcheck linter #88
Conversation
Instead of 'type NumericTypeuint struct' generates 'NumericTypeUint'
* docs: add initial CONTRIBUTING.md and link from README; this commit also adds initial Validations Table section in the README.md * docs: add contributing code This commit also adds a link to validations table * docs: add bug_report and feature_request issue templates adds behaviour bug report template adds aplication bug report template * docs: update application-bug-report * docs: update Issue_templates update application bug and feature request removed behaviour bug report * docs: renamed issue_template files * docs: update issue_templates * docs: update feature_request.yml * docs : update assignees
… to 10.28.0 (#86) chore(deps): bump github.com/go-playground/validator/v10 Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.27.0 to 10.28.0. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](go-playground/validator@v10.27.0...v10.28.0) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-version: 10.28.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
Pull Request Overview
This PR enables golangci-lint with the errcheck linter to improve code quality and error handling. The main changes include setting up a linting infrastructure and enhancing the parser to properly handle errors during struct field parsing.
- Added golangci-lint setup and configuration with errcheck linter enabled
- Refactored parser error handling to return errors instead of silently failing
- Enhanced type safety in AST parsing with proper type assertions
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Makefile | Added setup and lint targets with golangci-lint installation and execution |
| .golangci.yml | Comprehensive linting configuration with errcheck enabled |
| internal/parser/parser.go | Enhanced error handling in appendFields function with safe type assertions |
| tests/endtoend/numeric.go | Minor whitespace addition |
| } | ||
|
|
||
| func appendFields(structType *ast.StructType, packageName string, cstruct *Struct) { | ||
| func appendFields(structType *ast.StructType, packageName string, cstruct *Struct) error { |
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.
Vc pretende usar essa função em outro lugar em outro momento? Pois retornar vários erros para simplesmente ignorá-los não faz muito sentido, poderia só retornar um boolean 🙃
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.
Bom ponto. Tens razão. Vou alterar para retornar o erro. Valeu!
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.
Ajustei.
Closes #85
This PR introduces improvements to the build process and error handling in the parser, as well as adds new linting support. The main changes are grouped into build system enhancements and parser robustness improvements.
Build system enhancements:
setuptarget to theMakefileto automate installation ofgolangci-lintand alinttarget to run linting on the codebase. This helps ensure code quality and makes it easier to set up the development environment.Makefilefor thegolangci-lintinstallation path and binary, improving maintainability and clarity.Parser robustness improvements:
appendFieldsfunction ininternal/parser/parser.goto return an error, and updated its usage to handle errors during struct parsing. This adds better error reporting and prevents silent failures when parsing struct fields. [1] [2] [3]These changes collectively improve the reliability of the parser and streamline development workflows.