Closed radeksimko closed 5 years ago
Good catch, thanks! I'll take a closer look at it soon once we've completed some work over in Terraform itself.
Since writing this I've learned about go-cmp, which we've been using to good effect in Terraform tests recently. When looking at this I'll also see how much work it'd be to update the tests to use that instead of go-test/deep
, since that seems to have some better defaults and nicer failure output.
On second thought, let's just merge this now and I'll play with go-cmp
separately at some later date, since that's not at all urgent with this fix in place.
github.com/go-test/deep
has pretty low default settings for how deeply it should inspect nested structures. As an effect we were silently ignoring some differences.Also see https://github.com/go-test/deep/issues/17
I'm not sure if there's a better way/place where to set
MaxDepth
or whether this depth is appropriate, it's just an arbitrary number. I'm open to suggestions.I'm also adding a test which I used to invalidate my assumption that we parse
func()[idx]
incorrectly - i.e. there is nothing to fix, but I just thought it would be useful to have such test in place for the future, just in case.