From 6a5680afd507f10a0a4985fe34de18afc306261b Mon Sep 17 00:00:00 2001 From: Gleb Kanterov Date: Wed, 8 Jan 2025 17:35:13 +0100 Subject: [PATCH] Fix lint --- bundle/config/mutator/python/python_locations.go | 8 ++++---- bundle/config/mutator/python/python_mutator.go | 7 +++++-- bundle/config/mutator/python/python_mutator_test.go | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bundle/config/mutator/python/python_locations.go b/bundle/config/mutator/python/python_locations.go index 8c1233df9..36c61632c 100644 --- a/bundle/config/mutator/python/python_locations.go +++ b/bundle/config/mutator/python/python_locations.go @@ -117,7 +117,7 @@ func parsePythonLocations(input io.Reader) (*pythonLocations, error) { // putPythonLocation puts the location to the trie for the given path func putPythonLocation(trie *pythonLocations, path dyn.Path, location dyn.Location) { - var currentNode = trie + currentNode := trie for _, component := range path { if key := component.Key(); key != "" { @@ -151,9 +151,9 @@ func newPythonLocations() *pythonLocations { // findPythonLocation finds the location or closest ancestor location in the trie for the given path // if no ancestor or exact location is found, false is returned. func findPythonLocation(locations *pythonLocations, path dyn.Path) (dyn.Location, bool) { - var currentNode = locations - var lastLocation = locations.location - var exists = locations.exists + currentNode := locations + lastLocation := locations.location + exists := locations.exists for _, component := range path { if key := component.Key(); key != "" { diff --git a/bundle/config/mutator/python/python_mutator.go b/bundle/config/mutator/python/python_mutator.go index 445394478..2f9229845 100644 --- a/bundle/config/mutator/python/python_mutator.go +++ b/bundle/config/mutator/python/python_mutator.go @@ -6,7 +6,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/databricks/cli/bundle/config/mutator/paths" "io" "io/fs" "os" @@ -14,6 +13,10 @@ import ( "reflect" "strings" + "github.com/databricks/cli/bundle/config/mutator/paths" + + "github.com/databricks/cli/bundle/config/mutator/paths" + "github.com/databricks/databricks-sdk-go/logger" "github.com/fatih/color" @@ -393,7 +396,7 @@ func loadLocationsFile(locationsPath string) (*pythonLocations, error) { return parsePythonLocations(locationsFile) } -func loadOutputFile(rootPath string, outputPath string, locations *pythonLocations) (dyn.Value, diag.Diagnostics) { +func loadOutputFile(rootPath, outputPath string, locations *pythonLocations) (dyn.Value, diag.Diagnostics) { outputFile, err := os.Open(outputPath) if err != nil { return dyn.InvalidValue, diag.FromErr(fmt.Errorf("failed to open output file: %w", err)) diff --git a/bundle/config/mutator/python/python_mutator_test.go b/bundle/config/mutator/python/python_mutator_test.go index 127bd4214..29e63364f 100644 --- a/bundle/config/mutator/python/python_mutator_test.go +++ b/bundle/config/mutator/python/python_mutator_test.go @@ -681,7 +681,7 @@ or activate the environment before running CLI commands: assert.Equal(t, expected, out) } -func withProcessStub(t *testing.T, args []string, output string, diagnostics string, locations string) context.Context { +func withProcessStub(t *testing.T, args []string, output, diagnostics, locations string) context.Context { ctx := context.Background() ctx, stub := process.WithStub(ctx) @@ -730,7 +730,7 @@ func withProcessStub(t *testing.T, args []string, output string, diagnostics str } func getArg(args []string, name string) string { - for i := 0; i < len(args); i++ { + for i := range len(args) { if args[i] == name { return args[i+1] } @@ -738,7 +738,7 @@ func getArg(args []string, name string) string { return "" } -func loadYaml(name string, content string) *bundle.Bundle { +func loadYaml(name, content string) *bundle.Bundle { v, diag := config.LoadFromBytes(name, []byte(content)) if diag.Error() != nil {