Skip to content

Commit

Permalink
fix redundant err check
Browse files Browse the repository at this point in the history
  • Loading branch information
tuantran1702 committed May 9, 2024
1 parent e9df29b commit 8701127
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions store/snapshots/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,12 @@ func (s *Store) Load(height uint64, format uint32) (*types.Snapshot, <-chan io.R
}
err = func() error {
defer chunk.Close()

if _, err := io.Copy(pw, chunk); err != nil {
return fmt.Errorf("failed to copy chunk %d: %w", i, err)
}
if err != nil {
_ = pw.CloseWithError(err)
return err
return fmt.Errorf("failed to copy chunk %d: %w", i, err)
}

return pw.Close()
}()
if err != nil {
Expand Down

0 comments on commit 8701127

Please sign in to comment.