Skip to content

Conversation

@alexgarzao
Copy link
Collaborator

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:

  • Added a setup target to the Makefile to automate installation of golangci-lint and a lint target to run linting on the codebase. This helps ensure code quality and makes it easier to set up the development environment.
  • Defined new variables in the Makefile for the golangci-lint installation path and binary, improving maintainability and clarity.

Parser robustness improvements:

  • Refactored the appendFields function in internal/parser/parser.go to 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]
  • Improved type safety and error handling in field parsing by checking type assertions and returning descriptive errors when parsing array, map, and selector field types. This prevents panics and makes debugging easier.

These changes collectively improve the reliability of the parser and streamline development workflows.

Instead of 'type NumericTypeuint struct' generates 'NumericTypeUint'
alexgarzao and others added 11 commits October 3, 2025 10:24
* 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>
@alexgarzao alexgarzao requested a review from Copilot October 7, 2025 21:43
@alexgarzao alexgarzao self-assigned this Oct 7, 2025
Copy link
Contributor

Copilot AI left a 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 {

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 🙃

Copy link
Collaborator Author

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!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajustei.

@alexgarzao alexgarzao merged commit 82f3708 into main Oct 8, 2025
4 checks passed
@alexgarzao alexgarzao deleted the 85-enable-golang-ci-lint-and-errcheck-linter branch October 8, 2025 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable errcheck linter

4 participants