refactor: use Println in favor of Fprintln for os.Stdout

This commit is contained in:
Jose Diaz-Gonzalez
2020-02-22 04:32:51 -05:00
parent 9beefe923f
commit e5a9d29215
5 changed files with 19 additions and 19 deletions

View File

@@ -383,7 +383,7 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
for _, k := range flags {
if infoFlag == k {
v := infoFlags[k]
fmt.Fprintln(os.Stdout, v)
fmt.Println(v)
return
}
}

View File

@@ -14,7 +14,7 @@ func LogFail(text string) {
// LogInfo1 is the info1 header formatter
func LogInfo1(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf("-----> %s", text))
fmt.Println(fmt.Sprintf("-----> %s", text))
}
// LogInfo1Quiet is the info1 header formatter (with quiet option)
@@ -26,7 +26,7 @@ func LogInfo1Quiet(text string) {
// LogInfo2 is the info2 header formatter
func LogInfo2(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf("=====> %s", text))
fmt.Println(fmt.Sprintf("=====> %s", text))
}
// LogInfo2Quiet is the info2 header formatter (with quiet option)
@@ -39,7 +39,7 @@ func LogInfo2Quiet(text string) {
// LogVerbose is the verbose log formatter
// prints indented text to stdout
func LogVerbose(text string) {
fmt.Fprintln(os.Stdout, fmt.Sprintf(" %s", text))
fmt.Println(fmt.Sprintf(" %s", text))
}
// LogVerboseQuiet is the verbose log formatter

View File

@@ -68,7 +68,7 @@ func main() {
property := flag.Arg(3)
value := common.PropertyGet(pluginName, appName, property)
if value != "" {
fmt.Printf("%v\n", value)
fmt.Println(value)
}
case "get-all":
appName := flag.Arg(2)
@@ -79,7 +79,7 @@ func main() {
}
for key, value := range values {
fmt.Fprintln(os.Stdout, key, strings.TrimSuffix(value, "\n"))
fmt.Println(fmt.Sprintf("%s %s", key, strings.TrimSuffix(value, "\n"))
}
case "get-with-default":
appName := flag.Arg(2)
@@ -87,19 +87,19 @@ func main() {
defaultValue := flag.Arg(4)
value := common.PropertyGetDefault(pluginName, appName, property, defaultValue)
if value != "" {
fmt.Printf("%v\n", value)
fmt.Println(value)
}
case "lindex":
appName := flag.Arg(2)
property := flag.Arg(3)
index := strToInt(flag.Arg(4), 0, false)
propertyValue, err := common.PropertyListGetByIndex(pluginName, appName, property, index)
value, err := common.PropertyListGetByIndex(pluginName, appName, property, index)
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
os.Exit(1)
}
fmt.Printf("%v\n", propertyValue)
fmt.Println(value)
case "lismember":
appName := flag.Arg(2)
property := flag.Arg(3)
@@ -118,7 +118,7 @@ func main() {
os.Exit(1)
}
fmt.Printf("%v\n", length)
fmt.Println(length)
case "lrange":
appName := flag.Arg(2)
property := flag.Arg(3)
@@ -129,7 +129,7 @@ func main() {
}
for _, line := range lines {
fmt.Printf("%v\n", line)
fmt.Println(line)
}
case "lrem":
appName := flag.Arg(2)