From 19340a382dd2329c05600ed784b1130a5b952181 Mon Sep 17 00:00:00 2001 From: ranbo chen Date: Tue, 31 Oct 2017 21:08:56 +0800 Subject: [PATCH] clean up codes --- wal.go | 5 +---- wal_test.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) 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)