Skip to content

Commit 1298d36

Browse files
committed
fix: correct off-by-one error in findErrorBlockEnd defer insertion
The defer sess.Release() statements were being inserted inside error blocks instead of after them, making the defer unreachable. This fixes the line number mapping from AST positions back to the original lines array by removing the unnecessary -1 offset.
1 parent e2c9472 commit 1298d36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/internal/migrations/v3/session_release.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ func findErrorBlockEnd(lines []string, startIdx int) int {
349349
pos := fset.Position(ifStmt.Body.End())
350350
lineNum := pos.Line - 3
351351
if lineNum >= 0 {
352-
ifStmtEnd = snippetStartLine + lineNum - 1
352+
ifStmtEnd = snippetStartLine + lineNum
353353
return false
354354
}
355355
}

0 commit comments

Comments
 (0)