package multifile import ( "errors" "io" "os" ) type CompressWriter struct { *os.File Writer io.WriteCloser } func NewCompressWriter(file *os.File, writer io.WriteCloser) *CompressWriter { return &CompressWriter{ File: file, Writer: writer, } } func (cw *CompressWriter) Write(p []byte) (n int, err error) { return cw.Writer.Write(p) } func (cw *CompressWriter) Close() error { return errors.Join(cw.Writer.Close(), cw.File.Close()) }