diff --git a/wal.go b/wal.go index 925fa384a..ec3799857 100644 --- a/wal.go +++ b/wal.go @@ -714,10 +714,7 @@ func (w *SegmentWAL) Close() error { return errors.Wrapf(hf.Close(), "closing WAL head %s", hf.Name()) } - if w.dirFile != nil { - w.dirFile.Close() - } - return nil + return w.dirFile.Close() } const ( diff --git a/wal_test.go b/wal_test.go index b01ee2405..2e402d19f 100644 --- a/wal_test.go +++ b/wal_test.go @@ -273,7 +273,7 @@ func TestWALRestoreCorrupted_invalidSegment(t *testing.T) { Ok(t, err) f2, err := wal.createSegmentFile(dir + "/000002") Ok(t, err) - Ok(t, f2.Close()) // close for windows! + Ok(t, f2.Close()) // Make header of second segment invalid. _, err = f.WriteAt([]byte{1, 2, 3, 4}, 0)