Skip to content

Commit

Permalink
🐛 fix: fsutil - fix unit tests error for MustOpenFile
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Oct 13, 2023
1 parent d829299 commit be917ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion fsutil/operate_test.go
Expand Up @@ -111,7 +111,6 @@ func TestMustOpenFile(t *testing.T) {

of := fsutil.MustOpenFile(fpath, fsutil.FsRWFlags, 0600)
assert.Eq(t, "must-open-file", fsutil.ReadString(of))
assert.NoErr(t, of.Close())
}

func TestOpenAppendFile(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions fsutil/opread.go
Expand Up @@ -87,12 +87,12 @@ func ReadOrErr(in any) ([]byte, error) {
r, err := NewIOReader(in)
defer func() {
if r != nil {
file, ok := r.(*os.File)
if ok {
if file, ok := r.(*os.File); ok {
err = file.Close()
}
}
}()

if err != nil {
return nil, err
}
Expand Down

0 comments on commit be917ac

Please sign in to comment.