OpenFile mimics the os.OpenFile call, but always uses the FILE_SHARE_DELETE flag. Differences from os.OpenFile: - It's not possible to support the testlog package connection for tests since testlog is an internal package. - This will not try to open directories if there's a failure to open a file wi
(name string, flag int, perm os.FileMode)
| 29 | // - WriteAt will not return an error if the file is opened in append mode, as the |
| 30 | // required variable to do so is not exported from package os. |
| 31 | func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) { |
| 32 | if name == "" { |
| 33 | return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOENT} |
| 34 | } |
| 35 | h, e := syscallOpen(fixLongPath(name), flag|syscall.O_CLOEXEC, syscallMode(perm)) |
| 36 | if e != nil { |
| 37 | return nil, e |
| 38 | } |
| 39 | return os.NewFile(uintptr(h), name), nil |
| 40 | } |
| 41 | |
| 42 | func Open(name string) (*os.File, error) { |
| 43 | return OpenFile(name, os.O_RDONLY, 0) |
no test coverage detected