我有一个自定义结构,其中有一个未导出的字段。我希望能够将值与此结构的类型进行比较,但我收到如下恐慌消息:
panic: cannot handle unexported field at ...
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported
Run Code Online (Sandbox Code Playgroud)
示例代码:
panic: cannot handle unexported field at ...
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported
Run Code Online (Sandbox Code Playgroud)
如何修复此错误并比较变量?