opentofu/internal/tfdiags
Martin Atkins 5b5a285066 Replace github.com/go-test/deep with go-cmp
My original intention was just to reduce our number of dependencies by
standardizing on a single comparison library, but in the process of doing
so I found various examples of the kinds of problems that caused this
codebase to begin adopting go-cmp instead of go-test/deep in the first
place, which make it easy to accidentally write a false-positive test that
doesn't actually check what the author thinks is being checked:

- deep.Equal silently ignores unexported fields, so comparing two values
  that differ only in data in unexported fields succeeds even when it ought
  not to.

  TestContext2Apply_multiVarComprehensive in package tofu was an excellent
  example of this problem: it had various test assertions that were
  actually checking absolutely nothing, despite appearing to compare
  pairs of cty.Value.

- deep.Equal also silently ignores anything below a certain level of
  nesting, and so comparison of deep data structures can appear to succeed
  even though they don't actually match.

  There were a few examples where that problem had already been found and
  fixed by temporarily overriding the package deep global settings, but
  with go-cmp the default behavior already visits everything, or panics
  if it cannot.

This does mean that in a few cases this needed some more elaborate options
to cmp.Diff to align with the previous behavior, which is a little annoying
but overall I think better to be explicit about what each test is relying
on. Perhaps we can rework these tests to need fewer unusual cmp options
in future, but for this commit I want to keep focused on the smallest
possible changes to remove our dependency on github.com/go-test/deep .

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-10-13 08:17:40 -07:00
..
config_traversals.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
consolidate_warnings.go Using a Key on ExtraInfo to differentiate between Consolidation Warnings (#3036) 2025-07-24 12:20:57 -03:00
consolidate_warnings_test.go Warning and Error consolidation CLI options (#1894) 2024-09-23 07:31:06 -04:00
contextual.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
contextual_test.go Replace github.com/go-test/deep with go-cmp 2025-10-13 08:17:40 -07:00
diagnostic.go go.mod: Use the new "tool" directive 2025-10-10 07:06:56 -03:00
diagnostic_base.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
diagnostic_extra.go Ephemeral variables (#3108) 2025-09-10 07:45:23 -04:00
diagnostics.go Fix repetitive diagnosis output in init response (#1890) 2024-09-05 07:36:18 -04:00
diagnostics_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
doc.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
error.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
hcl.go fix internal/tofu tests on Windows (#3194) 2025-08-27 18:57:59 -03:00
hcl_test.go Allow configured providers to provide additional functions. (#1491) 2024-04-18 15:11:38 +02:00
override.go tfdiags: Override cooperates with contextual diagnostics 2025-05-06 14:54:24 -07:00
override_test.go tfdiags: Override cooperates with contextual diagnostics 2025-05-06 14:54:24 -07:00
rpc_friendly.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
rpc_friendly_test.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
severity_string.go Move tfdiags/ to internal/tfdiags/ 2021-05-17 14:09:07 -07:00
simple_warning.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00
source_range.go Fix repetitive diagnosis output in init response (#1890) 2024-09-05 07:36:18 -04:00
sourceless.go Update copyright notice (#1232) 2024-02-08 09:48:59 +00:00