Merge pull request #3870 from dokku/standardize-println
Use Println in favor of Fprintln for os.Stdout
This commit is contained in:
5 files changed
+19
-19
No files matched your search
@@ -383,7 +383,7 @@ func ReportSingleApp(reportType string, appName string, infoFlag string, infoFla
|
|||||||
for _, k := range flags {
|
for _, k := range flags {
|
||||||
if infoFlag == k {
|
if infoFlag == k {
|
||||||
v := infoFlags[k]
|
v := infoFlags[k]
|
||||||
fmt.Fprintln(os.Stdout, v)
|
fmt.Println(v)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ func LogFail(text string) {
|
|||||||
|
|
||||||
// LogInfo1 is the info1 header formatter
|
// LogInfo1 is the info1 header formatter
|
||||||
func LogInfo1(text string) {
|
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)
|
// LogInfo1Quiet is the info1 header formatter (with quiet option)
|
||||||
@@ -26,7 +26,7 @@ func LogInfo1Quiet(text string) {
|
|||||||
|
|
||||||
// LogInfo2 is the info2 header formatter
|
// LogInfo2 is the info2 header formatter
|
||||||
func LogInfo2(text string) {
|
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)
|
// LogInfo2Quiet is the info2 header formatter (with quiet option)
|
||||||
@@ -39,7 +39,7 @@ func LogInfo2Quiet(text string) {
|
|||||||
// LogVerbose is the verbose log formatter
|
// LogVerbose is the verbose log formatter
|
||||||
// prints indented text to stdout
|
// prints indented text to stdout
|
||||||
func LogVerbose(text string) {
|
func LogVerbose(text string) {
|
||||||
fmt.Fprintln(os.Stdout, fmt.Sprintf(" %s", text))
|
fmt.Println(fmt.Sprintf(" %s", text))
|
||||||
}
|
}
|
||||||
|
|
||||||
// LogVerboseQuiet is the verbose log formatter
|
// LogVerboseQuiet is the verbose log formatter
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func main() {
|
|||||||
property := flag.Arg(3)
|
property := flag.Arg(3)
|
||||||
value := common.PropertyGet(pluginName, appName, property)
|
value := common.PropertyGet(pluginName, appName, property)
|
||||||
if value != "" {
|
if value != "" {
|
||||||
fmt.Printf("%v\n", value)
|
fmt.Println(value)
|
||||||
}
|
}
|
||||||
case "get-all":
|
case "get-all":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
@@ -79,7 +79,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for key, value := range values {
|
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":
|
case "get-with-default":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
@@ -87,19 +87,19 @@ func main() {
|
|||||||
defaultValue := flag.Arg(4)
|
defaultValue := flag.Arg(4)
|
||||||
value := common.PropertyGetDefault(pluginName, appName, property, defaultValue)
|
value := common.PropertyGetDefault(pluginName, appName, property, defaultValue)
|
||||||
if value != "" {
|
if value != "" {
|
||||||
fmt.Printf("%v\n", value)
|
fmt.Println(value)
|
||||||
}
|
}
|
||||||
case "lindex":
|
case "lindex":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
property := flag.Arg(3)
|
property := flag.Arg(3)
|
||||||
index := strToInt(flag.Arg(4), 0, false)
|
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 {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err.Error())
|
fmt.Fprintln(os.Stderr, err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%v\n", propertyValue)
|
fmt.Println(value)
|
||||||
case "lismember":
|
case "lismember":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
property := flag.Arg(3)
|
property := flag.Arg(3)
|
||||||
@@ -118,7 +118,7 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%v\n", length)
|
fmt.Println(length)
|
||||||
case "lrange":
|
case "lrange":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
property := flag.Arg(3)
|
property := flag.Arg(3)
|
||||||
@@ -129,7 +129,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
fmt.Printf("%v\n", line)
|
fmt.Println(line)
|
||||||
}
|
}
|
||||||
case "lrem":
|
case "lrem":
|
||||||
appName := flag.Arg(2)
|
appName := flag.Arg(2)
|
||||||
|
|||||||
@@ -65,42 +65,42 @@ func TriggerNetworkComputePorts(appName string, processType string, isHerokuishC
|
|||||||
ports = append(ports, port)
|
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
|
// TriggerNetworkConfigExists writes true or false to stdout whether a given app has network config
|
||||||
func TriggerNetworkConfigExists(appName string) {
|
func TriggerNetworkConfigExists(appName string) {
|
||||||
if HasNetworkConfig(appName) {
|
if HasNetworkConfig(appName) {
|
||||||
fmt.Fprintln(os.Stdout, "true")
|
fmt.Println("true")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintln(os.Stdout, "false")
|
fmt.Println("false")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TriggerNetworkGetIppaddr writes the ipaddress to stdout for a given app container
|
// TriggerNetworkGetIppaddr writes the ipaddress to stdout for a given app container
|
||||||
func TriggerNetworkGetIppaddr(appName string, processType string, containerID string) {
|
func TriggerNetworkGetIppaddr(appName string, processType string, containerID string) {
|
||||||
ipAddress := GetContainerIpaddress(appName, processType, containerID)
|
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
|
// TriggerNetworkGetListeners returns the listeners (host:port combinations) for a given app container
|
||||||
func TriggerNetworkGetListeners(appName string) {
|
func TriggerNetworkGetListeners(appName string) {
|
||||||
listeners := GetListeners(appName)
|
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
|
// TriggerNetworkGetPort writes the port to stdout for a given app container
|
||||||
func TriggerNetworkGetPort(appName string, processType string, isHerokuishContainer bool, containerID string) {
|
func TriggerNetworkGetPort(appName string, processType string, isHerokuishContainer bool, containerID string) {
|
||||||
port := GetContainerPort(appName, processType, isHerokuishContainer, containerID)
|
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
|
// TriggerNetworkGetProperty writes the network property to stdout for a given app container
|
||||||
func TriggerNetworkGetProperty(appName string, property string) {
|
func TriggerNetworkGetProperty(appName string, property string) {
|
||||||
defaultValue := GetDefaultValue(property)
|
defaultValue := GetDefaultValue(property)
|
||||||
value := common.PropertyGetDefault("network", appName, property, defaultValue)
|
value := common.PropertyGetDefault("network", appName, property, defaultValue)
|
||||||
fmt.Fprintln(os.Stdout, value)
|
fmt.Println(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TriggerNetworkWriteIpaddr writes the ip to disk
|
// TriggerNetworkWriteIpaddr writes the ip to disk
|
||||||
|
|||||||
@@ -127,6 +127,6 @@ func TriggerResourceGetProperty(appName string, processType string, resourceType
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintln(os.Stdout, value)
|
fmt.Println(value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user