close closes the file if it is open.
()
| 206 | |
| 207 | // close closes the file if it is open. |
| 208 | func (w *Writer) close() error { |
| 209 | w.mu.Lock() |
| 210 | defer w.mu.Unlock() |
| 211 | if w.file == nil { |
| 212 | return nil |
| 213 | } |
| 214 | w.file.Sync() |
| 215 | err := w.file.Close() |
| 216 | w.file = nil |
| 217 | return err |
| 218 | } |
| 219 | |
| 220 | func (w *Writer) flush() error { |
| 221 | w.mu.Lock() |