mirror of https://github.com/databricks/cli.git
Fix lint
This commit is contained in:
parent
e1710ff9e4
commit
6a5680afd5
|
@ -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 != "" {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue