Skip to content

Commit

Permalink
Update docs and restore pkg var in test to original
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-nichter committed Dec 6, 2022
1 parent 9cf6ed6 commit c81fca0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deep.go
Expand Up @@ -27,7 +27,9 @@ var (
LogErrors = false

// CompareUnexportedFields causes unexported struct fields, like s in
// T{s int}, to be compared when true.
// T{s int}, to be compared when true. This does not work for comparing
// error or Time types on unexported fields because methods on unexported
// fields cannot be called.
CompareUnexportedFields = false

// NilSlicesAreEmpty causes a nil slice to be equal to an empty slice.
Expand Down
2 changes: 2 additions & 0 deletions deep_test.go
Expand Up @@ -1408,7 +1408,9 @@ func TestErrorUnexported(t *testing.T) {
type foo struct {
bar error
}
defaultCompareUnexportedFields := deep.CompareUnexportedFields
deep.CompareUnexportedFields = true
defer func() { deep.CompareUnexportedFields = defaultCompareUnexportedFields }()
e1 := foo{bar: fmt.Errorf("error")}
e2 := foo{bar: fmt.Errorf("error")}
deep.Equal(e1, e2)
Expand Down

0 comments on commit c81fca0

Please sign in to comment.