go-test / deep

Golang deep variable equality test that returns human-readable differences
MIT License
743 stars 54 forks source link

Not detecting drift in a struct within a nested slice #17

Closed kurtmaile closed 4 years ago

kurtmaile commented 6 years ago

Hi,

Ive started using this library its great!

I have been playing around testing this and works well. We have some big JSON that gets marshalled into structs, ive found changing something fairly deeply nested wasnt being picked up.

So orderLines is a slice, it DOES pick up a change to a field in the top of the slice like Id

e.g OrderEvent.Order.OrderLines.slice[0].Id

but if its another struct within the slice, it doesnt pick this up, like 'Gross' below

e.g OrderEvent.Order.OrderLines.slice[0].UnitPrice.Gross (float64)

Is this a know thing? Is there a limit how deep you can go?

Thanks!

daniel-nichter commented 6 years ago

Hello @kurtmaile. Yes, there are two const: MaxDiff and MaxDepth (https://godoc.org/github.com/go-test/deep). Perhaps these are the cause? If not, please provide some test data that reproduces the problem.

daniel-nichter commented 4 years ago

If this can be reproduced in a test case, please submit a PR. Until then, closing this issue.