Skip to content

Commit

Permalink
only check the file size, the file is not corrupted even close error
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 26, 2022
1 parent 687adf8 commit 7c658d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/file/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (w *BlockFileWatcher) fetch(blockNum int) error {
path := w.getFilePath(blockNum)
f, err := os.Open(path)
if err == nil {
defer f.Close()
defer f.Close() //nolint
// valid 1st 8 bytes for downloaded file
var bytes [8]byte
if _, err = io.ReadFull(f, bytes[:]); err == nil {
Expand All @@ -125,7 +125,7 @@ func (w *BlockFileWatcher) fetch(blockNum int) error {
return nil
}
}
f.Close()
f.Close() //nolint
}

// download if file not exist
Expand Down

0 comments on commit 7c658d8

Please sign in to comment.