Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed panic message in IgnoreUnexported #228

Merged
merged 1 commit into from Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmp/cmpopts/ignore.go
Expand Up @@ -128,7 +128,7 @@ func newUnexportedFilter(typs ...interface{}) unexportedFilter {
for _, typ := range typs {
t := reflect.TypeOf(typ)
if t == nil || t.Kind() != reflect.Struct {
panic(fmt.Sprintf("invalid struct type: %T", typ))
panic(fmt.Sprintf("%T must be a non-pointer struct", typ))
}
ux.m[t] = true
}
Expand Down
2 changes: 1 addition & 1 deletion cmp/cmpopts/struct_filter.go
Expand Up @@ -42,7 +42,7 @@ func newStructFilter(typ interface{}, names ...string) structFilter {

t := reflect.TypeOf(typ)
if t == nil || t.Kind() != reflect.Struct {
panic(fmt.Sprintf("%T must be a struct", typ))
panic(fmt.Sprintf("%T must be a non-pointer struct", typ))
}
var ft fieldTree
for _, name := range names {
Expand Down
6 changes: 3 additions & 3 deletions cmp/cmpopts/util_test.go
Expand Up @@ -1223,7 +1223,7 @@ func TestPanic(t *testing.T) {
label: "IgnoreFields",
fnc: IgnoreFields,
args: args(&Foo1{}, "Alpha"),
wantPanic: "must be a struct",
wantPanic: "must be a non-pointer struct",
reason: "the type must be a struct (not pointer to a struct)",
}, {
label: "IgnoreFields",
Expand Down Expand Up @@ -1304,13 +1304,13 @@ func TestPanic(t *testing.T) {
label: "IgnoreUnexported",
fnc: IgnoreUnexported,
args: args(nil),
wantPanic: "invalid struct type",
wantPanic: "must be a non-pointer struct",
reason: "input must not be nil value",
}, {
label: "IgnoreUnexported",
fnc: IgnoreUnexported,
args: args(&Foo1{}),
wantPanic: "invalid struct type",
wantPanic: "must be a non-pointer struct",
reason: "input must be a struct type (not a pointer to a struct)",
}, {
label: "IgnoreUnexported",
Expand Down