Skip to content

Commit

Permalink
Fix documentation on IgnoreFields (#220)
Browse files Browse the repository at this point in the history
The function now handles unexported fields since #203.
  • Loading branch information
dsnet authored Jun 17, 2020
1 parent 44914b3 commit 1227731
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cmp/cmpopts/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ import (
"github.com/google/go-cmp/cmp/internal/function"
)

// IgnoreFields returns an Option that ignores exported fields of the
// given names on a single struct type.
// IgnoreFields returns an Option that ignores fields of the
// given names on a single struct type. It respects the names of exported fields
// that are forwarded due to struct embedding.
// The struct type is specified by passing in a value of that type.
//
// The name may be a dot-delimited string (e.g., "Foo.Bar") to ignore a
// specific sub-field that is embedded or nested within the parent struct.
//
// This does not handle unexported fields; use IgnoreUnexported instead.
func IgnoreFields(typ interface{}, names ...string) cmp.Option {
sf := newStructFilter(typ, names...)
return cmp.FilterPath(sf.filter, cmp.Ignore())
Expand Down

0 comments on commit 1227731

Please sign in to comment.