github.com/v2pro/plz@v0.0.0-20221028024117-e5f9aec5b631/countlog/output/rotation/retain_by_count.go (about) 1 package rotation 2 3 type RetainByCount struct { 4 MaxArchivesCount int 5 } 6 7 func (strategy *RetainByCount) PurgeSet(archives []Archive) []Archive { 8 if len(archives) <= strategy.MaxArchivesCount { 9 return nil 10 } 11 purgeCount := len(archives) - strategy.MaxArchivesCount 12 return archives[:purgeCount] 13 }