Skip to content
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

Ensure mysql rows responses are closed #1132

Merged

Conversation

timvaillancourt
Copy link
Collaborator

@timvaillancourt timvaillancourt commented May 31, 2022

Description

This PR ensures the rows-responses from the MySQL driver are closed by using a defer rows.Close(), in order to follow database/sql best practices

Also, these linters are introduced to ensure we don't have this problem again:

  1. rowserrcheck

    checks whether Err of rows is checked successfully

  2. sqlclosecheck

    Checks that sql.Rows and sql.Stmt are closed

This PR resolves these linter errors:
Screen Shot 2022-06-01 at 01 25 56

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

@timvaillancourt timvaillancourt self-assigned this May 31, 2022
@timvaillancourt timvaillancourt added this to the v1.1.5 milestone Jun 2, 2022
@timvaillancourt timvaillancourt merged commit 6bf32f2 into github:master Jul 6, 2022
@timvaillancourt timvaillancourt deleted the golangci-lint-sql-linters branch July 6, 2022 21:32
dm-2 added a commit that referenced this pull request Jul 7, 2022
Co-authored-by: dm-2 <45519614+dm-2@users.noreply.github.com>
@dm-2 dm-2 mentioned this pull request Jul 7, 2022
dm-2 added a commit that referenced this pull request Jul 7, 2022
Co-authored-by: dm-2 <45519614+dm-2@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants