remove unused global output functions

This commit is contained in:
Michael Eischer
2025-09-14 14:31:39 +02:00
parent 320fb5fb98
commit 5a16b29177
2 changed files with 0 additions and 52 deletions

View File

@@ -197,44 +197,6 @@ func collectBackends() *location.Registry {
return backends
}
// Printf writes the message to the configured stdout stream.
func Printf(format string, args ...interface{}) {
_, err := fmt.Fprintf(globalOptions.stdout, format, args...)
if err != nil {
fmt.Fprintf(os.Stderr, "unable to write to stdout: %v\n", err)
}
}
// Print writes the message to the configured stdout stream.
func Print(args ...interface{}) {
_, err := fmt.Fprint(globalOptions.stdout, args...)
if err != nil {
fmt.Fprintf(os.Stderr, "unable to write to stdout: %v\n", err)
}
}
// Println writes the message to the configured stdout stream.
func Println(args ...interface{}) {
_, err := fmt.Fprintln(globalOptions.stdout, args...)
if err != nil {
fmt.Fprintf(os.Stderr, "unable to write to stdout: %v\n", err)
}
}
// Verbosef calls Printf to write the message when the verbose flag is set.
func Verbosef(format string, args ...interface{}) {
if globalOptions.verbosity >= 1 {
Printf(format, args...)
}
}
// Verboseff calls Printf to write the message when the verbosity is >= 2
func Verboseff(format string, args ...interface{}) {
if globalOptions.verbosity >= 2 {
Printf(format, args...)
}
}
// Warnf writes the message to the configured stderr stream.
func Warnf(format string, args ...interface{}) {
_, err := fmt.Fprintf(globalOptions.stderr, format, args...)

View File

@@ -12,20 +12,6 @@ import (
"github.com/restic/restic/internal/ui/progress"
)
func Test_PrintFunctionsRespectsGlobalStdout(t *testing.T) {
for _, p := range []func(){
func() { Println("message") },
func() { Print("message\n") },
func() { Printf("mes%s\n", "sage") },
} {
buf, _ := withCaptureStdout(GlobalOptions{}, func(_ GlobalOptions) error {
p()
return nil
})
rtest.Equals(t, "message\n", buf.String())
}
}
type errorReader struct{ err error }
func (r *errorReader) Read([]byte) (int, error) { return 0, r.err }