Skip to content

Commit 9fd52f7

Browse files
committed
fix: Solved 'cannot use UnableToReadFileError (variable of type string) as error value in return statement'
1 parent 5331187 commit 9fd52f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

filesystem/read_files.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package filesystem
22

33
import (
4+
"fmt"
45
"os"
56
)
67

78
// ReadFile reads the file from the given path
89
func ReadFile(path string) ([]byte, error) {
910
file, err := os.ReadFile(path)
1011
if err != nil {
11-
return nil, UnableToReadFileError
12+
return nil, fmt.Errorf(UnableToReadFileError, err)
1213
}
1314
return file, nil
1415
}

0 commit comments

Comments
 (0)