Skip to content

Commit

Permalink
Fix seg.Remove Swallowing Error (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghosx authored Jun 18, 2024
1 parent dea4745 commit cce2a07
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/valyala/bytebufferpool"
"hash/crc32"
"io"
"os"

"github.com/valyala/bytebufferpool"
)

type ChunkType = byte
Expand Down Expand Up @@ -140,7 +141,9 @@ func (seg *segment) Sync() error {
func (seg *segment) Remove() error {
if !seg.closed {
seg.closed = true
_ = seg.fd.Close()
if err := seg.fd.Close(); err != nil {
return err
}
}

return os.Remove(seg.fd.Name())
Expand Down

0 comments on commit cce2a07

Please sign in to comment.