IsZero has no effect on slices
No matter the setting of the IsZero option, nil and empty initialized slices are always considered the same.
Drawing from the TestHash_equalNil test function, adding this case will break tests:
{
Test{
Str: nil,
Int: nil,
Map: nil,
Slice: nil,
},
Test{
Str: nil,
Int: nil,
Map: nil,
Slice: make([]string, 0),
},
false,
false,
},
This test sets (first false) ZeroNil to false (thus differing nil from []string{}), and subsequently expects the hashes to be different (second false).
Changing the second false to true (thereby expecting same hashes from the two tests) passes the test, which obviously shouldn't be the case.
In fact, doing more testing, and based on the tests in the package, it seems only the integer pointer is affected by IsZero.
Making a test like the one above for each of the four pointer types only passes for the string pointer.
(Rename attached file to .go and put in dir, then run go test ./... to try this yourself)
hashstructure2_test.go.txt