config: fix lint issue and travis failures
Signed-off-by: Rohit Yadav <rohit@apache.org>
diff --git a/Makefile b/Makefile
index fbd28c0..e77b002 100644
--- a/Makefile
+++ b/Makefile
@@ -56,14 +56,10 @@
cd $(BASE)
rm -fr dist
mkdir -p dist
- GOOS=linux GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk-linux-amd64 cmk.go
- GOOS=linux GOARCH=386 $(GO) build -ldflags='-s -w' -o dist/cmk-linux-i386 cmk.go
- GOOS=linux GOARCH=arm64 $(GO) build -ldflags='-s -w' -o dist/cmk-linux-arm64 cmk.go
- GOOS=linux GOARCH=arm $(GO) build -ldflags='-s -w' -o dist/cmk-linux-arm cmk.go
- GOOS=windows GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk-x64.exe cmk.go
- GOOS=windows GOARCH=386 $(GO) build -ldflags='-s -w' -o dist/cmk-x32.exe cmk.go
- GOOS=darwin GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk-mac64.bin cmk.go
- GOOS=darwin GOARCH=386 $(GO) build -ldflags='-s -w' -o dist/cmk-mac32.bin cmk.go
+ GOOS=linux GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk.linux.amd64 cmk.go
+ GOOS=linux GOARCH=arm64 $(GO) build -ldflags='-s -w' -o dist/cmk.linux.arm64 cmk.go
+ GOOS=windows GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk.exe cmk.go
+ GOOS=darwin GOARCH=amd64 $(GO) build -ldflags='-s -w' -o dist/cmk.darwin.amd64 cmk.go
# Tools
diff --git a/cmd/request.go b/cmd/request.go
index 179080d..32e059a 100644
--- a/cmd/request.go
+++ b/cmd/request.go
@@ -29,6 +29,7 @@
Args []string
}
+// Client method returns the http Client for the current server profile
func (r *Request) Client() *http.Client {
return r.Config.ActiveProfile.Client
}
diff --git a/config/config.go b/config/config.go
index 0a87dd5..7d6fc09 100644
--- a/config/config.go
+++ b/config/config.go
@@ -44,13 +44,13 @@
// ServerProfile describes a management server
type ServerProfile struct {
- URL string `ini:"url"`
- Username string `ini:"username"`
- Password string `ini:"password"`
- Domain string `ini:"domain"`
- APIKey string `ini:"apikey"`
- SecretKey string `ini:"secretkey"`
- Client *http.Client
+ URL string `ini:"url"`
+ Username string `ini:"username"`
+ Password string `ini:"password"`
+ Domain string `ini:"domain"`
+ APIKey string `ini:"apikey"`
+ SecretKey string `ini:"secretkey"`
+ Client *http.Client `ini:"-"`
}
// Core block describes common options for the CLI
@@ -129,7 +129,7 @@
return profiles
}
-func newHttpClient(cfg *Config) *http.Client {
+func newHTTPClient(cfg *Config) *http.Client {
jar, _ := cookiejar.New(nil)
client := &http.Client{
Jar: jar,
@@ -211,7 +211,7 @@
profiles = append(profiles, profile.Name())
}
- cfg.ActiveProfile.Client = newHttpClient(cfg)
+ cfg.ActiveProfile.Client = newHTTPClient(cfg)
return cfg
}
diff --git a/config/spinner.go b/config/spinner.go
index 732032c..1b0b7f9 100644
--- a/config/spinner.go
+++ b/config/spinner.go
@@ -18,9 +18,10 @@
package config
import (
- "github.com/briandowns/spinner"
"runtime"
"time"
+
+ "github.com/briandowns/spinner"
)
var cursor = []string{"\r⣷ 😸", "\r⣯ 😹", "\r⣟ 😺", "\r⡿ 😻", "\r⢿ 😼", "\r⣻ 😽", "\r⣽ 😾", "\r⣾ 😻"}
@@ -37,12 +38,12 @@
return nil
}
waiter := spinner.New(cursor, 200*time.Millisecond)
- waiter.Color("blue", "bold")
waiter.Suffix = " " + suffix
waiter.Start()
return waiter
}
+// StopSpinner stops the provided spinner if it is valid
func (c *Config) StopSpinner(waiter *spinner.Spinner) {
if waiter != nil {
waiter.Stop()