From 503f91a87020208089828d5509cda15771dc15bc Mon Sep 17 00:00:00 2001 From: ayushsatyam146 Date: Tue, 3 Dec 2024 15:57:33 +0530 Subject: [PATCH] fixes lint --- internal/wal/wal_aof.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/wal/wal_aof.go b/internal/wal/wal_aof.go index f66f44b20..adfe3061e 100644 --- a/internal/wal/wal_aof.go +++ b/internal/wal/wal_aof.go @@ -122,7 +122,12 @@ func (wal *WALAOF) Init(t time.Time) error { wal.currentSegmentIndex = 0 wal.oldestSegmentIndex = 0 wal.byteOffset = 0 - wal.currentSegmentFile, err = os.OpenFile(filepath.Join(wal.logDir, "seg-0"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + newFile, err := os.OpenFile(filepath.Join(wal.logDir, "seg-0"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err != nil { + return err + } + wal.currentSegmentFile = newFile + if _, err := wal.currentSegmentFile.Seek(0, io.SeekEnd); err != nil { return err }