Replace fmt.Printf/Println/Fprintf with wrapper functions

cmd/restic/globals.go already provides Printf, Println and Warnf wrapper
which get their output streams from the globalOptions object. This
allows for stream replacements when testing.
This commit is contained in:
Michael Eischer committed 2020-06-14 11:08:11 +02:00
1 parent 74bc7141c1
commit 182655bc88
6 files changed
+19 -30

No files matched your search

+1 -3
View File
@@ -2,8 +2,6 @@ package main
import (
"context"
"fmt"
"os"
"sync"
"time"
@@ -79,7 +77,7 @@ func refreshLocks(wg *sync.WaitGroup, done <-chan struct{}) {
for _, lock := range globalLocks.locks {
err := lock.Refresh(context.TODO())
if err != nil {
fmt.Fprintf(os.Stderr, "unable to refresh lock: %v\n", err)
Warnf("unable to refresh lock: %v\n", err)
}
}
globalLocks.Unlock()