Scope error variables into if statements where possible#1486
Scope error variables into if statements where possible#1486rowanseymour merged 1 commit intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1486 +/- ##
==========================================
- Coverage 69.57% 69.56% -0.02%
==========================================
Files 306 306
Lines 18069 18059 -10
==========================================
- Hits 12572 12562 -10
Misses 5063 5063
Partials 434 434 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request refactors error handling throughout the codebase to use scoped error variables within if statements, following a well-established Go idiom. The changes convert the pattern err := func(); if err != nil to if err := func(); err != nil, which scopes the error variable more tightly to where it's actually used.
Changes:
- Refactored error variable declarations to be scoped within if statements across 6 files
- Applied the pattern consistently to various function calls including JSON unmarshaling, validation, and callback operations
- No behavioral changes, only improved variable scoping
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| utils/validator.go | Scoped error variable in UnmarshalAndValidate function |
| flows/inputs/msg.go | Scoped error variable in readMsg function |
| flows/definition/legacy/definition.go | Scoped error variables in migrateAction and migrateRuleSet functions (4 instances) |
| excellent/base.go | Scoped error variable in VisitTemplate function |
| contactql/parser.go | Scoped error variables in BoolCombination.validate and ParseQuery functions (2 instances) |
| cmd/docgen/docs/base.go | Scoped error variable in Generate function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.