Przeglądaj źródła

pkg/ioutils: remove unused functions

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Stephen J Day 8 lat temu
rodzic
commit
c546894aef
2 zmienionych plików z 0 dodań i 39 usunięć
  1. 0 22
      pkg/ioutils/fmt.go
  2. 0 17
      pkg/ioutils/fmt_test.go

+ 0 - 22
pkg/ioutils/fmt.go

@@ -1,22 +0,0 @@
-package ioutils
-
-import (
-	"fmt"
-	"io"
-)
-
-// FprintfIfNotEmpty prints the string value if it's not empty
-func FprintfIfNotEmpty(w io.Writer, format, value string) (int, error) {
-	if value != "" {
-		return fmt.Fprintf(w, format, value)
-	}
-	return 0, nil
-}
-
-// FprintfIfTrue prints the boolean value if it's true
-func FprintfIfTrue(w io.Writer, format string, ok bool) (int, error) {
-	if ok {
-		return fmt.Fprintf(w, format, ok)
-	}
-	return 0, nil
-}

+ 0 - 17
pkg/ioutils/fmt_test.go

@@ -1,17 +0,0 @@
-package ioutils
-
-import "testing"
-
-func TestFprintfIfNotEmpty(t *testing.T) {
-	wc := NewWriteCounter(&NopWriter{})
-	n, _ := FprintfIfNotEmpty(wc, "foo%s", "")
-
-	if wc.Count != 0 || n != 0 {
-		t.Errorf("Wrong count: %v vs. %v vs. 0", wc.Count, n)
-	}
-
-	n, _ = FprintfIfNotEmpty(wc, "foo%s", "bar")
-	if wc.Count != 6 || n != 6 {
-		t.Errorf("Wrong count: %v vs. %v vs. 6", wc.Count, n)
-	}
-}