type filePipeline … func newFilePipeline(lg *zap.Logger, dir string, fileSize int64) *filePipeline { … } // Open returns a fresh file for writing. Rename the file before calling // Open again or there will be file collisions. func (fp *filePipeline) Open() (f *fileutil.LockedFile, err error) { … } func (fp *filePipeline) Close() error { … } func (fp *filePipeline) alloc() (f *fileutil.LockedFile, err error) { … } func (fp *filePipeline) run() { … }