Skip to content

Commit 332af0b

Browse files
committed
fix: annotate unhandled defer rows/tree Close in codegraph
Annotate 6 deferred Close calls in codegraph with the errcheck nolint pattern already used in algorithms_cgo.go, so the package has one consistent rule for read-only resource cleanup. Touches: - internal/codegraph/embeddings_cgo.go - internal/codegraph/codegraph_cgo.go Verification: go vet, staticcheck, gofumpt, go test -short all clean.
1 parent 99b25f0 commit 332af0b

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

internal/codegraph/codegraph_cgo.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (cg *CodeGraph) IndexFile(filePath string) error {
294294
if err != nil {
295295
return err
296296
}
297-
defer tree.Close()
297+
defer tree.Close() //nolint:errcheck // deferred Close on read-only tree is cleanup-only
298298

299299
// Delete old nodes for this file
300300
cg.mu.Lock()
@@ -466,7 +466,7 @@ func (cg *CodeGraph) Search(query string, limit int) ([]Node, error) {
466466
return nil, err
467467
}
468468
}
469-
defer rows.Close()
469+
defer rows.Close() //nolint:errcheck // deferred Close on read-only rows is cleanup-only
470470

471471
return scanNodes(rows)
472472
}
@@ -752,7 +752,7 @@ func (cg *CodeGraph) ResolveRefs() error {
752752
if err != nil {
753753
return err
754754
}
755-
defer rows.Close()
755+
defer rows.Close() //nolint:errcheck // deferred Close on read-only rows is cleanup-only
756756

757757
type ref struct {
758758
id int
@@ -1352,7 +1352,7 @@ func (cg *CodeGraph) Files(dirFilter string) ([]FileEntry, error) {
13521352
if err != nil {
13531353
return nil, err
13541354
}
1355-
defer rows.Close()
1355+
defer rows.Close() //nolint:errcheck // deferred Close on read-only rows is cleanup-only
13561356

13571357
var files []FileEntry
13581358
for rows.Next() {
@@ -1464,7 +1464,7 @@ func (cg *CodeGraph) searchByName(name string, limit int) ([]Node, error) {
14641464
if err != nil {
14651465
return nil, err
14661466
}
1467-
defer rows.Close()
1467+
defer rows.Close() //nolint:errcheck // deferred Close on read-only rows is cleanup-only
14681468
return scanNodes(rows)
14691469
}
14701470

internal/codegraph/embeddings_cgo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func (cg *CodeGraph) SemanticSearch(query string, limit int) ([]Node, error) {
3737
if err != nil {
3838
return nil, err
3939
}
40-
defer rows.Close()
40+
defer rows.Close() //nolint:errcheck // deferred Close on read-only rows is cleanup-only
4141

4242
allNodes, _ := scanNodes(rows)
4343

0 commit comments

Comments
 (0)