aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/lamport/persisted_clock.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/util/lamport/persisted_clock.go b/util/lamport/persisted_clock.go
index b9246f73..a069b379 100644
--- a/util/lamport/persisted_clock.go
+++ b/util/lamport/persisted_clock.go
@@ -3,7 +3,7 @@ package lamport
import (
"errors"
"fmt"
- "io/ioutil"
+ "io"
"os"
"github.com/go-git/go-billy/v5"
@@ -77,9 +77,14 @@ func (pc *PersistedClock) read() error {
if err != nil {
return err
}
- defer f.Close()
- content, err := ioutil.ReadAll(f)
+ content, err := io.ReadAll(f)
+ if err != nil {
+ _ = f.Close()
+ return err
+ }
+
+ err = f.Close()
if err != nil {
return err
}