aboutsummaryrefslogtreecommitdiff
path: root/cmp/cmpopts/ignore.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2020-06-17 14:23:43 -0700
committerGitHub <noreply@github.com>2020-06-17 14:23:43 -0700
commit12277310d373db3799bcc3f14684adee17319122 (patch)
treef04dc1c9614a9ac2f448b86629cbb720d67189c9 /cmp/cmpopts/ignore.go
parent44914b370698a5a9ce868549d62d79473faebacc (diff)
downloadgo-cmp-12277310d373db3799bcc3f14684adee17319122.tar.gz
Fix documentation on IgnoreFields (#220)
The function now handles unexported fields since #203.
Diffstat (limited to 'cmp/cmpopts/ignore.go')
-rw-r--r--cmp/cmpopts/ignore.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmp/cmpopts/ignore.go b/cmp/cmpopts/ignore.go
index ff8e785..afd36be 100644
--- a/cmp/cmpopts/ignore.go
+++ b/cmp/cmpopts/ignore.go
@@ -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())