github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/internal/buf/buf.go (about)

     1  package buf
     2  
     3  import (
     4  	"bytes"
     5  )
     6  
     7  type buffer struct {
     8  	*bytes.Buffer
     9  }
    10  
    11  func (b *buffer) Close() error {
    12  	b.Buffer.Reset()
    13  	return nil
    14  }
    15  
    16  func New(b *bytes.Buffer) *buffer {
    17  	if b == nil {
    18  		b = bytes.NewBuffer(nil)
    19  	}
    20  	return &buffer{b}
    21  }