Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix redundant rows.Close() calls in queryCode.tmpl#3856

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
lushenle wants to merge1 commit intosqlc-dev:main
base:main
Choose a base branch
Loading
fromlushenle:fix-rows-close-issue

Conversation

lushenle
Copy link

Description

This pull request addresses an issue in the generated query code templatequeryCode.tmpl whererows.Close() was being called multiple times. This change ensures thatrows.Close() is only called once usingdefer, which is a best practice for resource management in Go.

Changes

  • Updated thequeryCode.tmpl template to usedefer rows.Close() for ensuring the rows are closed properly.
  • Removed the redundantrows.Close() call after the loop.

Rationale

Callingrows.Close() multiple times is unnecessary and can lead to potential issues. Usingdefer to close the rows ensures that the resource is properly released exactly once, following Go's best practices.

@dosubotdosubotbot added size:XSThis PR changes 0-9 lines, ignoring generated files. 🔧 golang labelsFeb 21, 2025
- Updated queryCode.tmpl to use defer for rows.Close()- Ensured rows.Close() is called only once- Improved resource management following Go best practices
@dosubotdosubotbot added size:LThis PR changes 100-499 lines, ignoring generated files. and removed size:XSThis PR changes 0-9 lines, ignoring generated files. labelsFeb 24, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
size:LThis PR changes 100-499 lines, ignoring generated files.🔧 golang
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@lushenle

[8]ページ先頭

©2009-2025 Movatter.jp