databricks-cli/libs
shreyas-goenka 4d8eba04cd
Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520)
## Changes

This PR makes two changes:

1. In https://github.com/databricks/cli/pull/1510 we'll be adding
multiple associated location metadata with a dyn.Value. The Go compiler
does not allow comparing structs if they contain slice values
(presumably due to multiple possible definitions for equality). In
anticipation for adding a `[]dyn.Location` type field to `dyn.Value`
this PR removes all direct comparisons of `dyn.Value` and instead relies
on the kind.

2. Retain location metadata for values in convert.FromTyped. The change
diff is exactly the same as https://github.com/databricks/cli/pull/1523.
It's been combined with this PR because they both depend on each other
to prevent test failures (forming a test failure deadlock).

Go patch used:
```
@@
var x expression
@@
-x == dyn.InvalidValue
+x.Kind() == dyn.KindInvalid

@@
var x expression
@@
-x != dyn.InvalidValue
+x.Kind() != dyn.KindInvalid

@@
var x expression
@@
-x == dyn.NilValue
+x.Kind() == dyn.KindNil

@@
var x expression
@@
-x != dyn.NilValue
+x.Kind() != dyn.KindNil
```
 

## Tests
Unit tests and integration tests pass.
2024-06-27 13:28:19 +00:00
..
auth Improve token refresh flow (#1434) 2024-05-16 10:22:09 +00:00
cmdgroup Add trailing newline in usage string (#1382) 2024-04-19 14:12:52 +00:00
cmdio Added `auth describe` command (#1244) 2024-04-03 08:14:04 +00:00
databrickscfg Update error checks that use the `os` package to use `errors.Is` (#1461) 2024-06-03 12:39:36 +00:00
diag Make bundle validation print text output by default (#1335) 2024-04-03 15:33:43 +00:00
dyn Compare `.Kind()` instead of direct equality checks on a `dyn.Value` (#1520) 2024-06-27 13:28:19 +00:00
env Fix `panic: $HOME is not set` (#1027) 2023-11-29 19:08:27 +00:00
errs Added ability for deferred mutator execution (#380) 2023-05-16 18:01:50 +02:00
exec Fixed building Python artifacts on Windows with WSL (#1249) 2024-03-01 15:59:47 +00:00
filer Return `fs.ModeDir` for Git folders in the workspace (#1521) 2024-06-24 10:15:13 +00:00
fileset Abstract over filesystem interaction with libs/vfs (#1452) 2024-05-30 07:41:50 +00:00
flags Add override to support YAML inputs for apps (#921) 2023-10-27 18:57:26 +00:00
folders Move folders package into libs (#1184) 2024-02-07 16:33:18 +00:00
git Remove user credentials specified in the Git origin URL (#1494) 2024-06-17 09:49:00 +00:00
jsonschema Fix bundle schema for variables (#1396) 2024-04-25 11:23:50 +00:00
locker Correct name for force acquire deploy flag (#656) 2023-08-15 19:03:43 +00:00
log Rewrite the friendly log handler (#1038) 2023-12-01 12:17:04 +00:00
notebook Update error checks that use the `os` package to use `errors.Is` (#1461) 2024-06-03 12:39:36 +00:00
process Add ApplyPythonMutator (#1430) 2024-06-20 08:43:08 +00:00
python Added `python.DetectInterpreters` and other utils (#805) 2023-10-03 10:47:09 +00:00
set Added support for sync.include and sync.exclude sections (#671) 2023-08-18 08:07:25 +00:00
sync Clean up unused code (#1502) 2024-06-18 14:14:27 +00:00
tags Library to validate and normalize cloud specific tags (#819) 2023-09-29 08:49:08 +00:00
template Fix typo in DBT template (#1498) 2024-06-17 15:56:49 +00:00
terraform Add bundle destroy command (#300) 2023-04-06 12:54:58 +02:00
testfile Refactor and cover edge cases in sync integration tests (#160) 2023-01-10 13:16:30 +01:00
textutil Add support for Lakehouse monitoring in bundles (#1307) 2024-05-31 09:42:25 +00:00
vfs Abstract over filesystem interaction with libs/vfs (#1452) 2024-05-30 07:41:50 +00:00