databricks-cli/bundle/deploy/terraform
Pieter Noordhuis ed194668db
Return `diag.Diagnostics` from mutators (#1305)
## Changes

This diagnostics type allows us to capture multiple warnings as well as
errors in the return value. This is a preparation for returning
additional warnings from mutators in case we detect non-fatal problems.

* All return statements that previously returned an error now return
`diag.FromErr`
* All return statements that previously returned `fmt.Errorf` now return
`diag.Errorf`
* All `err != nil` checks now use `diags.HasError()` or `diags.Error()`

## Tests

* Existing tests pass.
* I confirmed no call site under `./bundle` or `./cmd/bundle` uses
`errors.Is` on the return value from mutators. This is relevant because
we cannot wrap errors with `%w` when calling `diag.Errorf` (like
`fmt.Errorf`; context in https://github.com/golang/go/issues/47641).
2024-03-25 14:18:47 +00:00
..
tfdyn Include `dyn.Path` as argument to the visit callback function (#1260) 2024-03-07 13:56:50 +00:00
apply.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
convert.go Use `dyn.Value` as input to generating Terraform JSON (#1218) 2024-02-16 20:54:38 +00:00
convert_test.go Use `dyn.Value` as input to generating Terraform JSON (#1218) 2024-02-16 20:54:38 +00:00
destroy.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
dir.go Consolidate environment variable interaction (#747) 2023-09-11 08:18:43 +00:00
import.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
init.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
init_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
interpolate.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
interpolate_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
load.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
load_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
pkg.go Fix summary command when internal terraform config doesn't exist (#1242) 2024-03-01 08:25:12 +00:00
plan.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_pull.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_pull_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_push.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_push_test.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
state_test.go Added deployment state for bundles (#1267) 2024-03-18 14:41:58 +00:00
unbind.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00
util.go Do not truncate local state file when pulling remote changes (#382) 2023-05-16 17:02:33 +02:00
util_test.go Correctly overwrite local state if remote state is newer (#1008) 2023-11-24 11:15:46 +00:00
write.go Return `diag.Diagnostics` from mutators (#1305) 2024-03-25 14:18:47 +00:00