the returned file should be closed by the caller
(path string)
| 48 | |
| 49 | // the returned file should be closed by the caller |
| 50 | func Open(path string) (*os.File, error) { |
| 51 | cleanPath, err := EscapeTilde(path) |
| 52 | if err != nil { |
| 53 | return nil, err |
| 54 | } |
| 55 | |
| 56 | file, err := os.Open(cleanPath) |
| 57 | if err != nil { |
| 58 | return nil, errors.Wrap(err, errors.Message(ErrorReadFile(path))) |
| 59 | } |
| 60 | |
| 61 | return file, nil |
| 62 | } |
| 63 | |
| 64 | // the returned file should be closed by the caller |
| 65 | func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error) { |
no test coverage detected