diff options
author | Michael Muré <batolettre@gmail.com> | 2023-01-11 14:30:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 14:30:52 +0100 |
commit | 9c50a359704f4edd2f33df6d256e032feae3a576 (patch) | |
tree | 1c6732eb1a87ee9f65da62a6cf156bd441a2f02a /util/lamport | |
parent | 76100380978418dbfa6fa880f05d335c9a4aafcd (diff) | |
parent | ace0f055074a6ecee0f9893d545f0ff6f7fc3c45 (diff) | |
download | git-bug-9c50a359704f4edd2f33df6d256e032feae3a576.tar.gz |
Merge pull request #989 from MichaelMure/fix-tests
repo: check error when closing a repo in tests
Diffstat (limited to 'util/lamport')
-rw-r--r-- | util/lamport/persisted_clock.go | 11 |
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 } |