This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git


The following commit(s) were added to refs/heads/main by this push:
     new b7eb34a  lint: fix failures (#171)
b7eb34a is described below

commit b7eb34aceab650f571a73975bf22197027d0f81f
Author: Abhishek Kumar <[email protected]>
AuthorDate: Wed Aug 6 17:44:46 2025 +0530

    lint: fix failures (#171)
    
    Fixes `make lint`
    
    Signed-off-by: Abhishek Kumar <[email protected]>
---
 Makefile         | 7 +++++--
 cmd/network.go   | 5 ++---
 cmk.go           | 6 +++---
 config/config.go | 8 ++++++--
 4 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index b54b956..ee8b657 100644
--- a/Makefile
+++ b/Makefile
@@ -67,9 +67,12 @@ dist: dist-linux
 
 # Tools
 
+$(BIN):
+       @mkdir -p $(BIN)
+
 GOLINT = $(BIN)/golint
-$(BIN)/golint:  $(BASE) ; $(info $(M) Building golint…)
-       $Q go get github.com/golang/lint/golint
+$(BIN)/golint: | $(BIN) ; $(info $(M) Building golint…)
+       $Q GOBIN=$(BIN) go install golang.org/x/lint/golint@latest
 
 GOCOVMERGE = $(BIN)/gocovmerge
 $(BIN)/gocovmerge: | $(BASE) ; $(info $(M) building gocovmerge…)
diff --git a/cmd/network.go b/cmd/network.go
index 1c1f67c..8665e81 100644
--- a/cmd/network.go
+++ b/cmd/network.go
@@ -299,8 +299,7 @@ func executeRequest(r *Request, requestURL string, params 
url.Values) (*http.Res
        if params.Has("password") || params.Has("userdata") || 
r.Config.Core.PostRequest {
                requestURL = fmt.Sprintf("%s", r.Config.ActiveProfile.URL)
                return r.Client().PostForm(requestURL, params)
-       } else {
-               req, _ := http.NewRequestWithContext(*r.Config.Context, "GET", 
requestURL, nil)
-               return r.Client().Do(req)
        }
+       req, _ := http.NewRequestWithContext(*r.Config.Context, "GET", 
requestURL, nil)
+       return r.Client().Do(req)
 }
diff --git a/cmk.go b/cmk.go
index 767cd4e..89bd5dc 100644
--- a/cmk.go
+++ b/cmk.go
@@ -47,7 +47,7 @@ func main() {
        debug := flag.Bool("d", false, "enable debug mode")
        profile := flag.String("p", "", "server profile")
        configFilePath := flag.String("c", "", "config file path")
-       acsUrl := flag.String("u", config.DEFAULT_ACS_API_ENDPOINT, 
"cloudStack's API endpoint URL")
+       acsURL := flag.String("u", config.DefaultACSAPIEndpoint, "cloudStack's 
API endpoint URL")
        apiKey := flag.String("k", "", "cloudStack user's API Key")
        secretKey := flag.String("s", "", "cloudStack user's secret Key")
        flag.Parse()
@@ -72,8 +72,8 @@ func main() {
                cfg.UpdateConfig("output", *outputFormat, false)
        }
 
-       if *acsUrl != config.DEFAULT_ACS_API_ENDPOINT {
-               cfg.UpdateConfig("url", *acsUrl, false)
+       if *acsURL != config.DefaultACSAPIEndpoint {
+               cfg.UpdateConfig("url", *acsURL, false)
        }
 
        if *apiKey != "" {
diff --git a/config/config.go b/config/config.go
index 52ee9f0..3245f4e 100644
--- a/config/config.go
+++ b/config/config.go
@@ -45,7 +45,8 @@ const (
        DEFAULT = "default"
 )
 
-const DEFAULT_ACS_API_ENDPOINT = "http://localhost:8080/client/api";
+// DefaultACSAPIEndpoint is the default API endpoint for CloudStack.
+const DefaultACSAPIEndpoint = "http://localhost:8080/client/api";
 
 // ServerProfile describes a management server
 type ServerProfile struct {
@@ -84,10 +85,12 @@ type Config struct {
        C             chan bool
 }
 
+// GetOutputFormats returns the supported output formats.
 func GetOutputFormats() []string {
        return []string{"column", "csv", "json", "table", "text", "default"}
 }
 
+// CheckIfValuePresent checks if an element is present in the dataset.
 func CheckIfValuePresent(dataset []string, element string) bool {
        for _, arg := range dataset {
                if arg == element {
@@ -158,7 +161,7 @@ func defaultCoreConfig() Core {
 
 func defaultProfile() ServerProfile {
        return ServerProfile{
-               URL:       DEFAULT_ACS_API_ENDPOINT,
+               URL:       DefaultACSAPIEndpoint,
                Username:  "admin",
                Password:  "password",
                Domain:    "/",
@@ -189,6 +192,7 @@ func GetProfiles() []string {
        return profiles
 }
 
+// SetupContext initializes the context and signal handling for the config.
 func SetupContext(cfg *Config) {
        cfg.C = make(chan bool)
        signals := make(chan os.Signal, 1)

Reply via email to