Skip to content

Commit b7eb34a

Browse files
authored
lint: fix failures (#171)
Fixes `make lint` Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 79f09fb commit b7eb34a

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ dist: dist-linux
6767

6868
# Tools
6969

70+
$(BIN):
71+
@mkdir -p $(BIN)
72+
7073
GOLINT = $(BIN)/golint
71-
$(BIN)/golint: $(BASE) ; $(info $(M) Building golint…)
72-
$Q go get github.com/golang/lint/golint
74+
$(BIN)/golint: | $(BIN) ; $(info $(M) Building golint…)
75+
$Q GOBIN=$(BIN) go install golang.org/x/lint/golint@latest
7376

7477
GOCOVMERGE = $(BIN)/gocovmerge
7578
$(BIN)/gocovmerge: | $(BASE) ; $(info $(M) building gocovmerge…)

cmd/network.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ func executeRequest(r *Request, requestURL string, params url.Values) (*http.Res
299299
if params.Has("password") || params.Has("userdata") || r.Config.Core.PostRequest {
300300
requestURL = fmt.Sprintf("%s", r.Config.ActiveProfile.URL)
301301
return r.Client().PostForm(requestURL, params)
302-
} else {
303-
req, _ := http.NewRequestWithContext(*r.Config.Context, "GET", requestURL, nil)
304-
return r.Client().Do(req)
305302
}
303+
req, _ := http.NewRequestWithContext(*r.Config.Context, "GET", requestURL, nil)
304+
return r.Client().Do(req)
306305
}

cmk.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
debug := flag.Bool("d", false, "enable debug mode")
4848
profile := flag.String("p", "", "server profile")
4949
configFilePath := flag.String("c", "", "config file path")
50-
acsUrl := flag.String("u", config.DEFAULT_ACS_API_ENDPOINT, "cloudStack's API endpoint URL")
50+
acsURL := flag.String("u", config.DefaultACSAPIEndpoint, "cloudStack's API endpoint URL")
5151
apiKey := flag.String("k", "", "cloudStack user's API Key")
5252
secretKey := flag.String("s", "", "cloudStack user's secret Key")
5353
flag.Parse()
@@ -72,8 +72,8 @@ func main() {
7272
cfg.UpdateConfig("output", *outputFormat, false)
7373
}
7474

75-
if *acsUrl != config.DEFAULT_ACS_API_ENDPOINT {
76-
cfg.UpdateConfig("url", *acsUrl, false)
75+
if *acsURL != config.DefaultACSAPIEndpoint {
76+
cfg.UpdateConfig("url", *acsURL, false)
7777
}
7878

7979
if *apiKey != "" {

config/config.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ const (
4545
DEFAULT = "default"
4646
)
4747

48-
const DEFAULT_ACS_API_ENDPOINT = "http://localhost:8080/client/api"
48+
// DefaultACSAPIEndpoint is the default API endpoint for CloudStack.
49+
const DefaultACSAPIEndpoint = "http://localhost:8080/client/api"
4950

5051
// ServerProfile describes a management server
5152
type ServerProfile struct {
@@ -84,10 +85,12 @@ type Config struct {
8485
C chan bool
8586
}
8687

88+
// GetOutputFormats returns the supported output formats.
8789
func GetOutputFormats() []string {
8890
return []string{"column", "csv", "json", "table", "text", "default"}
8991
}
9092

93+
// CheckIfValuePresent checks if an element is present in the dataset.
9194
func CheckIfValuePresent(dataset []string, element string) bool {
9295
for _, arg := range dataset {
9396
if arg == element {
@@ -158,7 +161,7 @@ func defaultCoreConfig() Core {
158161

159162
func defaultProfile() ServerProfile {
160163
return ServerProfile{
161-
URL: DEFAULT_ACS_API_ENDPOINT,
164+
URL: DefaultACSAPIEndpoint,
162165
Username: "admin",
163166
Password: "password",
164167
Domain: "/",
@@ -189,6 +192,7 @@ func GetProfiles() []string {
189192
return profiles
190193
}
191194

195+
// SetupContext initializes the context and signal handling for the config.
192196
func SetupContext(cfg *Config) {
193197
cfg.C = make(chan bool)
194198
signals := make(chan os.Signal, 1)

0 commit comments

Comments
 (0)