databricks-cli/libs/dyn
Pieter Noordhuis 8255c9d9fb
Make `Append` function to `dyn.Path` return independent slice (#1295)
## Changes

While working on #1273, I found that calls to `Append` on a
`dyn.Pattern` were mutating the original slice. This is expected because
appending to a slice will mutate in place if the capacity of the
original slice is large enough. This change updates the `Append` call on
the `dyn.Path` as well to return a newly allocated slice to avoid
inadvertently mutating the originals.

We have existing call sites in the `dyn` package that mutate a
`dyn.Path` (e.g. walk or visit) and these are modified to continue to do
this with a direct call to `append`. Callbacks that use the `dyn.Path`
argument outside of the callback need to make a copy to ensure it isn't
mutated (this is no different from existing semantics).

The `Join` function wasn't used and is removed as part of this change.

## Tests

Unit tests.
2024-03-19 09:49:26 +00:00
..
convert Handle alias types for map keys in toTyped conversion (#1232) 2024-02-22 15:17:43 +00:00
dynvar Allow use of variables references in primitive non-string fields (#1219) 2024-02-19 10:44:51 +00:00
merge Include `dyn.Path` as argument to the visit callback function (#1260) 2024-03-07 13:56:50 +00:00
yamlloader Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
yamlsaver Generate correct YAML if custom_tags or spark_conf is used for pipeline or job cluster configuration (#1210) 2024-02-15 15:03:19 +00:00
kind.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
kind_test.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
location.go Retain location annotation when expanding globs for pipeline libraries (#1274) 2024-03-11 21:59:36 +00:00
location_test.go Retain location annotation when expanding globs for pipeline libraries (#1274) 2024-03-11 21:59:36 +00:00
path.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
path_string.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path_string_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00
path_test.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
pattern.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
pattern_test.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
value.go Use dynamic configuration model in bundles (#1098) 2024-02-16 19:41:58 +00:00
value_test.go Define constant for the invalid `dyn.Value` (#1101) 2024-01-05 13:02:04 +00:00
value_underlying.go Consolidate functions to convert `dyn.Value` to native types (#1100) 2024-01-05 12:06:12 +00:00
value_underlying_test.go Consolidate functions to convert `dyn.Value` to native types (#1100) 2024-01-05 12:06:12 +00:00
visit.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
visit_get.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_get_test.go Add functionality to visit values in `dyn.Value` tree (#1142) 2024-01-24 18:38:46 +00:00
visit_map.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
visit_map_test.go Add `dyn.MapByPattern` to map a function to values with matching paths (#1266) 2024-03-08 14:33:01 +00:00
visit_set.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
visit_set_test.go Add functionality to visit values in `dyn.Value` tree (#1142) 2024-01-24 18:38:46 +00:00
walk.go Make `Append` function to `dyn.Path` return independent slice (#1295) 2024-03-19 09:49:26 +00:00
walk_test.go Rename libs/config -> libs/dyn (#1086) 2023-12-22 13:20:45 +00:00