databricks-cli/libs/dyn/dynvar
Pieter Noordhuis f54e790a3b
Ensure every variable reference is passed to lookup function (#1176)
## Changes

References to keys that themselves are also variable references were
shortcircuited in the previous approach. This meant that certain fields
were resolved even if the lookup function would have instructed to skip
resolution.

To fix this we separate the memoization of resolved variable references
from the memoization of lookups. Now, every variable reference is passed
through the lookup function.

## Tests

Before this change, the new test failed with:
```
=== RUN   TestResolveWithSkipEverything
    [...]/libs/dyn/dynvar/resolve_test.go:208: 
        	Error Trace:	[...]/libs/dyn/dynvar/resolve_test.go:208
        	Error:      	Not equal: 
        	            	expected: "${d} ${c} ${c} ${d}"
        	            	actual  : "${b} ${a} ${a} ${b}"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-${d} ${c} ${c} ${d}
        	            	+${b} ${a} ${a} ${b}
        	Test:       	TestResolveWithSkipEverything
```
2024-02-06 15:01:49 +00:00
..
lookup.go Add `dynvar` package for variable resolution with a `dyn.Value` tree (#1143) 2024-01-24 18:49:06 +00:00
lookup_test.go Add `dynvar` package for variable resolution with a `dyn.Value` tree (#1143) 2024-01-24 18:49:06 +00:00
ref.go Add `dynvar` package for variable resolution with a `dyn.Value` tree (#1143) 2024-01-24 18:49:06 +00:00
ref_test.go Add `dynvar` package for variable resolution with a `dyn.Value` tree (#1143) 2024-01-24 18:49:06 +00:00
resolve.go Ensure every variable reference is passed to lookup function (#1176) 2024-02-06 15:01:49 +00:00
resolve_test.go Ensure every variable reference is passed to lookup function (#1176) 2024-02-06 15:01:49 +00:00