Merge pull request #3870 from dokku/standardize-println

Use Println in favor of Fprintln for os.Stdout
This commit is contained in:
Jose Diaz-Gonzalez
2020-02-22 06:36:20 -05:00
committed by GitHub
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)

View File

@@ -65,42 +65,42 @@ func TriggerNetworkComputePorts(appName string, processType string, isHerokuishC
ports = append(ports, port)
}
}
fmt.Fprint(os.Stdout, strings.Join(ports, " "))
fmt.Println(strings.Join(ports, " "))
}
// TriggerNetworkConfigExists writes true or false to stdout whether a given app has network config
func TriggerNetworkConfigExists(appName string) {
if HasNetworkConfig(appName) {
fmt.Fprintln(os.Stdout, "true")
fmt.Println("true")
return
}
fmt.Fprintln(os.Stdout, "false")
fmt.Println("false")
}
// TriggerNetworkGetIppaddr writes the ipaddress to stdout for a given app container
func TriggerNetworkGetIppaddr(appName string, processType string, containerID string) {
ipAddress := GetContainerIpaddress(appName, processType, containerID)
fmt.Fprintln(os.Stdout, ipAddress)
fmt.Println(ipAddress)
}
// TriggerNetworkGetListeners returns the listeners (host:port combinations) for a given app container
func TriggerNetworkGetListeners(appName string) {
listeners := GetListeners(appName)
fmt.Fprint(os.Stdout, strings.Join(listeners, " "))
fmt.Println(strings.Join(listeners, " "))
}
// TriggerNetworkGetPort writes the port to stdout for a given app container
func TriggerNetworkGetPort(appName string, processType string, isHerokuishContainer bool, containerID string) {
port := GetContainerPort(appName, processType, isHerokuishContainer, containerID)
fmt.Fprintln(os.Stdout, port)
fmt.Println(port)
}
// TriggerNetworkGetProperty writes the network property to stdout for a given app container
func TriggerNetworkGetProperty(appName string, property string) {
defaultValue := GetDefaultValue(property)
value := common.PropertyGetDefault("network", appName, property, defaultValue)
fmt.Fprintln(os.Stdout, value)
fmt.Println(value)
}
// TriggerNetworkWriteIpaddr writes the ip to disk

View File

@@ -127,6 +127,6 @@ func TriggerResourceGetProperty(appName string, processType string, resourceType
return err
}
fmt.Fprintln(os.Stdout, value)
fmt.Println(value)
return nil
}