github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/output/rotation/purge_by_delete.go (about)

     1  package rotation
     2  
     3  import (
     4  	"os"
     5  	"github.com/v2pro/plz"
     6  )
     7  
     8  type PurgeByDelete struct {
     9  }
    10  
    11  func (strategy *PurgeByDelete) Purge(purgeSet []Archive) error {
    12  	var errs []error
    13  	for _, archive := range purgeSet {
    14  		err := os.Remove(archive.Path)
    15  		if err != nil {
    16  			errs = append(errs, err)
    17  		}
    18  	}
    19  	return plz.MergeErrors(errs...)
    20  }