chore: fix errcheck and staticcheck linting errors#1002
Conversation
|
Warning Review limit reached
More reviews will be available in 57 minutes and 52 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| return nil, err | ||
| } | ||
| defer rows.Close() | ||
| defer func() { _ = rows.Close() }() |
There was a problem hiding this comment.
The four defer rows.Close() changes should be reverted. The pattern doesn't need changing — in stops_rtree.go it intentionally mirrors sqlc-generated code, where plain defer rows.Close() is correct because any error Close() could return is already surfaced by rows.Err(). The same applies in block_layover_test.go.
There was a problem hiding this comment.
@burma-shave Ok, I made this because when I run make lint on my local it gives me an errcheck. I will revert to the past pattern, but should I comment with //nolint:errcheck to bypass the local linter or ignore this errcheck?




Changes Included:
errcheckFixes: Addressed unhandled errors fromrows.Close()ingtfsdb/block_layover_test.goandgtfsdb/stops_rtree.goby wrapping them in anonymousdeferfunctions.staticcheck(QF1008) Fixes: Removed redundant embedded field selectors (e.g., calling.Time.Timeor.ServiceDate.Time) ininternal/models/current_time_test.goandinternal/models/trip_details_test.goto utilize Go's promoted methods for cleaner syntax.