mirror of https://github.com/databricks/cli.git
dac5f09556
## Changes There are four different treatments location metadata can receive in the `convert.FromTyped` method. 1. Location metadata is **retained** for maps, structs and slices if the value is **not nil** 2. Location metadata is **lost** for maps, structs and slices if the value is **is nil** 3. Location metadata is **retained** if a scalar type (eg. bool, string etc) does not change. 4. Location metadata is **lost** if the value for a scalar type changes. This PR ensures that location metadata is not lost in any case; that is, it's always preserved. For (2), this serves as a bug fix so that location information is not lost on conversion to and from typed for nil values of complex types (struct, slices, and maps). For (4) this is a change in semantics. For primitive values modified in a `typed` mutator, any references to `.Location()` for computed primitive fields will now return associated YAML location metadata (if any) instead of an empty location. While arguable, these semantics are OK since: 1. Situations like these will be rare. 2. Knowing the YAML location (if any) is better than not knowing the location at all. These locations are typically visible to the user in errors and warnings. ## Tests Unit tests |
||
---|---|---|
.. | ||
auth | ||
cmdgroup | ||
cmdio | ||
databrickscfg | ||
diag | ||
dyn | ||
env | ||
errs | ||
exec | ||
filer | ||
fileset | ||
flags | ||
folders | ||
git | ||
jsonschema | ||
locker | ||
log | ||
notebook | ||
process | ||
python | ||
set | ||
sync | ||
tags | ||
template | ||
terraform | ||
testfile | ||
textutil | ||
vfs |