Remove unused function

This commit is contained in:
Dane Everitt 2022-02-05 11:14:48 -05:00
parent 879dcd8df5
commit 1372eba84e

View File

@ -3,12 +3,10 @@ package system
import ( import (
"bufio" "bufio"
"bytes" "bytes"
"context"
"fmt" "fmt"
"io" "io"
"strconv" "strconv"
"sync" "sync"
"time"
"emperror.dev/errors" "emperror.dev/errors"
"github.com/goccy/go-json" "github.com/goccy/go-json"
@ -122,22 +120,6 @@ func ScanReader(r io.Reader, callback func(line []byte)) error {
return nil return nil
} }
// Runs a given work function every "d" duration until the provided context is canceled.
func Every(ctx context.Context, d time.Duration, work func(t time.Time)) {
ticker := time.NewTicker(d)
go func() {
for {
select {
case <-ctx.Done():
ticker.Stop()
return
case t := <-ticker.C:
work(t)
}
}
}()
}
func FormatBytes(b int64) string { func FormatBytes(b int64) string {
if b < 1024 { if b < 1024 {
return fmt.Sprintf("%d B", b) return fmt.Sprintf("%d B", b)