Address more feedback

This commit is contained in:
Gleb Kanterov 2024-10-08 10:26:53 +02:00
parent 43ce278299
commit bfb13afa8e
No known key found for this signature in database
GPG Key ID: 4D87C640DBD00176
1 changed files with 19 additions and 18 deletions

View File

@ -59,7 +59,11 @@ type pythonLocationEntry struct {
// validation errors will point to Python source code instead of generated YAML. // validation errors will point to Python source code instead of generated YAML.
func mergePythonLocations(value dyn.Value, locations *pythonLocations) (dyn.Value, error) { func mergePythonLocations(value dyn.Value, locations *pythonLocations) (dyn.Value, error) {
return dyn.Walk(value, func(path dyn.Path, value dyn.Value) (dyn.Value, error) { return dyn.Walk(value, func(path dyn.Path, value dyn.Value) (dyn.Value, error) {
if newLocation, ok := findPythonLocation(locations, path); ok { newLocation, ok := findPythonLocation(locations, path)
if !ok {
return value, nil
}
var newLocations []dyn.Location var newLocations []dyn.Location
// the first item in the list is the "last" location used for error reporting // the first item in the list is the "last" location used for error reporting
@ -76,9 +80,6 @@ func mergePythonLocations(value dyn.Value, locations *pythonLocations) (dyn.Valu
} }
return value.WithLocations(newLocations), nil return value.WithLocations(newLocations), nil
} else {
return value, nil
}
}) })
} }