Skip to content

suggest cmpopts.EquateErrors in error comparison panic #233

Closed
@neild

Description

@neild

This panics:

cmp.Equal(errors.New("x"), errors.New("x"))
panic: cannot handle unexported field at {*errors.errorString}.s:
	"errors".errorString
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported

The panic could detect when the type being compared implements error and suggest using cmpopts.EquateErrors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions