This commit is contained in:
Gleb Kanterov 2025-01-08 17:35:13 +01:00
parent e1710ff9e4
commit 6a5680afd5
No known key found for this signature in database
GPG Key ID: 4D87C640DBD00176
3 changed files with 12 additions and 9 deletions

View File

@ -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 != "" {

View File

@ -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))

View File

@ -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 {