Skip to content

Commit

Permalink
fix(argoproj#9963):Add logic to handle for fileHandle.Close()
Browse files Browse the repository at this point in the history
Signed-off-by: xin.li <xin.li@daocloud.io>
  • Loading branch information
my-git9 committed Sep 18, 2022
1 parent da9063b commit 5251e9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion util/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@ func TestLFSClient(t *testing.T) {
fileHandle, err := os.Open(fmt.Sprintf("%s/test3.yaml", tempDir))
assert.NoError(t, err)
if err == nil {
defer fileHandle.Close()
defer func() {
if err = fileHandle.Close(); err != nil {
assert.NoError(t, err)
}
}()
text, err := io.ReadAll(fileHandle)
assert.NoError(t, err)
if err == nil {
Expand Down

0 comments on commit 5251e9d

Please sign in to comment.