databricks-cli/libs/config/convert
Pieter Noordhuis 2c908f8fea
Function to convert Go struct back to `config.Value` (#935)
## Changes

This PR is the counterpart to #904. With this change, we are able to
convert a `config.Value` into a Go struct, make modifications to the Go
struct, and reflect those changes in a new `config.Value`.

This functionality allows us to incrementally introduce this
configuration representation to existing bundle mutators. Bundle
mutators expect a `*bundle.Bundle` argument and mutate its configuration
directly. These mutations are not reflected in the corresponding
`config.Value` (once introduced), which means we cannot use the
`config.Value` as source of truth until we update _all_ mutators. To
address this, we can run `convert.ToTyped` and `convert.FromTyped` at
the mutator boundary (from `bundle.Apply`) and capture changes made to
the Go struct. Then we can incrementally make mutators aware of the
`config.Value` configuration and have them mutate that structure
directly.

## Tests

New unit tests pass.

Manual spot checks against the bundle configuration type.
2023-11-15 09:19:51 +00:00
..
end_to_end_test.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
error.go Library to convert config.Value to Go struct (#904) 2023-10-24 11:12:36 +00:00
from_typed.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
from_typed_test.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
normalize.go Add configuration normalization code (#915) 2023-10-25 11:56:42 +00:00
normalize_test.go Add configuration normalization code (#915) 2023-10-25 11:56:42 +00:00
struct_info.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
struct_info_test.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
to_typed.go Function to convert Go struct back to `config.Value` (#935) 2023-11-15 09:19:51 +00:00
to_typed_test.go Library to convert config.Value to Go struct (#904) 2023-10-24 11:12:36 +00:00