no not print empty keys in docker info

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
Victor Vieux 2015-05-29 16:48:02 -07:00
parent b538852b61
commit 27435a1e56
2 changed files with 31 additions and 0 deletions

14
ioutils/fmt.go Normal file
View file

@ -0,0 +1,14 @@
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
}