From 0b170815901b37cec0ff99448d4ab592658c2d84 Mon Sep 17 00:00:00 2001 From: Aaron Son Date: Wed, 15 Jan 2025 05:37:20 -0800 Subject: [PATCH] go/store/nbs: ghost_store.go: Close file after initialization. --- go/store/nbs/ghost_store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go/store/nbs/ghost_store.go b/go/store/nbs/ghost_store.go index a3e8be1232e..11d23de6a68 100644 --- a/go/store/nbs/ghost_store.go +++ b/go/store/nbs/ghost_store.go @@ -54,6 +54,7 @@ func NewGhostBlockStore(nomsPath string) (*GhostBlockStore, error) { // Other error, permission denied, etc, we want to hear about. return nil, err } + defer f.Close() scanner := bufio.NewScanner(f) skiplist := &hash.HashSet{} for scanner.Scan() { @@ -107,6 +108,7 @@ func (g *GhostBlockStore) PersistGhostHashes(ctx context.Context, hashes hash.Ha if err != nil { return err } + defer f.Close() for h := range hashes { if _, err := f.WriteString(h.String() + "\n"); err != nil {