openSplit opens or creates the last split corresponding to fname and returns it. The last split can be fname itself.
(fname string)
| 57 | // openSplit opens or creates the last split corresponding to fname |
| 58 | // and returns it. The last split can be fname itself. |
| 59 | func openSplit(fname string) (*os.File, error) { |
| 60 | for { |
| 61 | next, _, err := nextSplit(fname) |
| 62 | if err != nil { |
| 63 | return nil, err |
| 64 | } |
| 65 | |
| 66 | if !fileExists(next) { |
| 67 | break |
| 68 | } |
| 69 | |
| 70 | fname = next |
| 71 | } |
| 72 | |
| 73 | return open(fname) |
| 74 | } |
| 75 | |
| 76 | func (w *splitWriter) Write(p []byte) (n int, err error) { |
| 77 | return w.f.Write(p) |
no test coverage detected