From fdfb631477a182184d452f37a337ca00feeba1fa Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Sun, 21 Jan 2024 16:47:46 -0500 Subject: [PATCH] suggested by GoLand --- src/cmd/deploy.go | 2 +- src/cmd/policy.go | 6 +++--- src/cmd/tag.go | 2 +- src/cmd/terraform.go | 6 +++--- src/common/helpers.go | 8 ++++---- src/common/helpers_test.go | 2 +- src/common/output_test.go | 2 +- src/common/prompts.go | 2 +- src/submodules/opslevel-go | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/cmd/deploy.go b/src/cmd/deploy.go index 1fe272d1..94244e91 100644 --- a/src/cmd/deploy.go +++ b/src/cmd/deploy.go @@ -10,7 +10,7 @@ import ( "github.com/opslevel/opslevel-go/v2023" "github.com/creasty/defaults" - git "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5" "github.com/rs/zerolog/log" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/src/cmd/policy.go b/src/cmd/policy.go index 1a5836a1..6cb11226 100644 --- a/src/cmd/policy.go +++ b/src/cmd/policy.go @@ -83,11 +83,11 @@ func toASTValue[T astMarshallable](input T) (ast.Value, error) { } func getKeyFromMapByMaxValue(m map[string]float64) string { - max := float64(0) + maximum := float64(0) var output string for k, v := range m { - if v > max { - max = v + if v > maximum { + maximum = v output = k } } diff --git a/src/cmd/tag.go b/src/cmd/tag.go index e6f2edb8..a52f3ee4 100644 --- a/src/cmd/tag.go +++ b/src/cmd/tag.go @@ -102,7 +102,7 @@ opslevel get tag --type=Service my-service-alias foo tags, err := result.GetTags(client, nil) cobra.CheckErr(err) - output := []opslevel.Tag{} + output := make([]opslevel.Tag, 0) for _, tag := range tags.Nodes { if tagKey == tag.Key { output = append(output, tag) diff --git a/src/cmd/terraform.go b/src/cmd/terraform.go index ec6198b4..9bb723ed 100644 --- a/src/cmd/terraform.go +++ b/src/cmd/terraform.go @@ -97,7 +97,7 @@ provider "opslevel" { graphqlClient := getClientGQL() exportConstants(graphqlClient, constants) - exportRepos(graphqlClient, repos, bash) + exportRepos(graphqlClient, repos) exportServices(graphqlClient, bash, directory) exportTeams(graphqlClient, teams, bash) exportFilters(graphqlClient, filters, bash) @@ -182,7 +182,7 @@ func exportConstants(c *opslevel.Client, config *os.File) { } } -func exportRepos(c *opslevel.Client, config *os.File, shell *os.File) { +func exportRepos(c *opslevel.Client, config *os.File) { repoConfig := `data "opslevel_repository" "%s" { alias = "%s" } @@ -203,7 +203,7 @@ func flattenAliases(aliases []string) string { } func flattenTags(tags []opslevel.Tag) string { - tagStrings := []string{} + tagStrings := make([]string, 0) for _, tag := range tags { tagStrings = append(tagStrings, fmt.Sprintf("%s:%s", tag.Key, tag.Value)) } diff --git a/src/common/helpers.go b/src/common/helpers.go index 136466ca..94d32173 100644 --- a/src/common/helpers.go +++ b/src/common/helpers.go @@ -36,13 +36,13 @@ func YamlPrint(object interface{}) { } func MinInt(values ...int) int { - min := values[0] + minimum := values[0] for _, val := range values { - if val < min { - min = val + if val < minimum { + minimum = val } } - return min + return minimum } diff --git a/src/common/helpers_test.go b/src/common/helpers_test.go index 6ffb3fb4..b08a7d0f 100644 --- a/src/common/helpers_test.go +++ b/src/common/helpers_test.go @@ -3,7 +3,7 @@ package common_test import ( "testing" - common "github.com/opslevel/cli/common" + "github.com/opslevel/cli/common" "github.com/rocktavious/autopilot" ) diff --git a/src/common/output_test.go b/src/common/output_test.go index 7001eb17..73b31233 100644 --- a/src/common/output_test.go +++ b/src/common/output_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - common "github.com/opslevel/cli/common" + "github.com/opslevel/cli/common" "github.com/rocktavious/autopilot" ) diff --git a/src/common/prompts.go b/src/common/prompts.go index 12c3bedb..85902678 100644 --- a/src/common/prompts.go +++ b/src/common/prompts.go @@ -160,7 +160,7 @@ func PromptForIntegration(client *opslevel.Client) (*opslevel.Integration, error {{ "Type:" | faint }} {{ .Type }}`, } - filteredList := []opslevel.Integration{} + filteredList := make([]opslevel.Integration, 0) for _, val := range list { if val.Type == "generic" { filteredList = append(filteredList, val) diff --git a/src/submodules/opslevel-go b/src/submodules/opslevel-go index b21e3b9b..ba5d57f1 160000 --- a/src/submodules/opslevel-go +++ b/src/submodules/opslevel-go @@ -1 +1 @@ -Subproject commit b21e3b9b5fbf10a2ae97704df766bdc986ecc999 +Subproject commit ba5d57f1f5917943bfc3d32e8d89756838778610