This is an automated email from the ASF dual-hosted git repository. rohit pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git
The following commit(s) were added to refs/heads/master by this push: new 3ad5ace config: fix lint issue and travis failures 3ad5ace is described below commit 3ad5ace6750bc0c2c37f34c9123f10221454b417 Author: Rohit Yadav <ro...@apache.org> AuthorDate: Tue Jun 26 14:26:02 2018 +0530 config: fix lint issue and travis failures Signed-off-by: Rohit Yadav <ro...@apache.org> --- Makefile | 12 ++++-------- cmd/request.go | 1 + config/config.go | 18 +++++++++--------- config/spinner.go | 5 +++-- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index fbd28c0..e77b002 100644 --- a/Makefile +++ b/Makefile @@ -56,14 +56,10 @@ dist: 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 @@ type Request struct { 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 @@ const ( // 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 @@ func GetProfiles() []string { 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 @@ func reloadConfig(cfg *Config) *Config { 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 @@ func (c *Config) StartSpinner(suffix string) *spinner.Spinner { 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()