cmk: fix formating using gofmt
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
diff --git a/cmd/output.go b/cmd/output.go
index 9a02369..b697da9 100644
--- a/cmd/output.go
+++ b/cmd/output.go
@@ -37,7 +37,7 @@
if reflect.TypeOf(value).Kind() == reflect.Map || reflect.TypeOf(value).Kind() == reflect.Slice {
var jsonStr []byte
var err error
- if (format == "text") {
+ if format == "text" {
jsonStr, err = json.MarshalIndent(value, "", "")
} else {
jsonStr, err = json.Marshal(value)
diff --git a/cmd/set.go b/cmd/set.go
index c426948..ee7c737 100644
--- a/cmd/set.go
+++ b/cmd/set.go
@@ -18,10 +18,10 @@
package cmd
import (
+ "errors"
"fmt"
"reflect"
"strings"
- "errors"
"github.com/apache/cloudstack-cloudmonkey/config"
)
@@ -64,7 +64,7 @@
validArgs := r.Command.SubCommands[subCommand]
if len(validArgs) != 0 && subCommand != "timeout" {
if !config.CheckIfValuePresent(validArgs, value) {
- return errors.New("Invalid value set for " + subCommand +". Supported values: " + strings.Join(validArgs, ", ") )
+ return errors.New("Invalid value set for " + subCommand + ". Supported values: " + strings.Join(validArgs, ", "))
}
}
r.Config.UpdateConfig(subCommand, value, true)
diff --git a/cmk.go b/cmk.go
index b614b95..ff9325e 100644
--- a/cmk.go
+++ b/cmk.go
@@ -42,7 +42,7 @@
func main() {
validFormats := strings.Join(config.GetOutputFormats(), ",")
- outputFormat := flag.String("o", "", "output format: " + validFormats)
+ outputFormat := flag.String("o", "", "output format: "+validFormats)
showVersion := flag.Bool("v", false, "show version")
debug := flag.Bool("d", false, "enable debug mode")
profile := flag.String("p", "", "server profile")
diff --git a/config/config.go b/config/config.go
index cca7913..5be1336 100644
--- a/config/config.go
+++ b/config/config.go
@@ -35,12 +35,12 @@
// Output formats
const (
- COLUMN = "column"
- CSV = "csv"
- JSON = "json"
- TABLE = "table"
- TEXT = "text"
- DEFAULT= "default"
+ COLUMN = "column"
+ CSV = "csv"
+ JSON = "json"
+ TABLE = "table"
+ TEXT = "text"
+ DEFAULT = "default"
)
// ServerProfile describes a management server
@@ -77,7 +77,7 @@
}
func GetOutputFormats() []string {
- return []string {"column", "csv", "json", "table", "text", "default"}
+ return []string{"column", "csv", "json", "table", "text", "default"}
}
func CheckIfValuePresent(dataset []string, element string) bool {
@@ -88,6 +88,7 @@
}
return false
}
+
// CacheFile returns the path to the cache file for a server profile
func (c Config) CacheFile() string {
cacheDir := path.Join(c.Dir, "profiles")
@@ -102,7 +103,7 @@
func hasAccess(path string) bool {
status := true
file, err := os.Open(path)
- if (err != nil) {
+ if err != nil {
status = false
}
file.Close()
@@ -136,12 +137,12 @@
func defaultCoreConfig() Core {
return Core{
- Prompt: "🐱",
- AsyncBlock: true,
- Timeout: 1800,
- Output: JSON,
- VerifyCert: true,
- ProfileName: "localcloud",
+ Prompt: "🐱",
+ AsyncBlock: true,
+ Timeout: 1800,
+ Output: JSON,
+ VerifyCert: true,
+ ProfileName: "localcloud",
AutoComplete: true,
}
}
@@ -253,7 +254,7 @@
// Update
core := new(Core)
conf.Section(ini.DEFAULT_SECTION).MapTo(core)
- if (!conf.Section(ini.DEFAULT_SECTION).HasKey("autocomplete")) {
+ if !conf.Section(ini.DEFAULT_SECTION).HasKey("autocomplete") {
core.AutoComplete = true
}
cfg.Core = core