oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

ci: enable more linters and fix issues

Open stevenh opened this issue 2 years ago • 3 comments

Enable more linters for golangci-lint and fix the issues that the additional linters highlight.

This addresses:

  • Missing error checks.
  • Duplicate code.
  • Direct error comparison instead of errors.As or errors.Is.
  • Missing error wrapping.
  • Test helpers.
  • Document comments.
  • Missing http Request.Body.Close()
  • Switches instead of complex ifs.
  • Use strings.ReplaceAll instead of strings.Replace with -1.
  • Unnecessary blank lines.
  • Duplicate literal strings.
  • Unneeded casts.
  • Removed inits.
  • Preallocate slices.
  • Unused parameters and vars.
  • Invalid error return when using time fallback case.

Also:

  • Merge ci steps into one so it runs quicker.
  • Add go 1.19 (latest) to validation.

stevenh avatar Nov 23 '22 20:11 stevenh

@53jk1 do you want me to rebase to resolve conflicts?

stevenh avatar Jan 25 '23 19:01 stevenh

@stevenh I think rebase would be good

kbakdev avatar Jan 25 '23 19:01 kbakdev

@53jk1 done

stevenh avatar Jan 25 '23 20:01 stevenh

Thanks and sorry we didn't get around to accepting this. We've added some of the changes. If there are any linter rules that you think are worthwhile, please raise an issue and we can work out how best to decide when we want to add them (https://github.com/deepmap/oapi-codegen/issues/1587)

jamietanna avatar May 03 '24 20:05 jamietanna