codesamplex

示例

Compare embedded structs containing unexported fields using cmpopts.IgnoreUnexported without runtime panics

sha256:9f8c44be217d87c6d3754da5318c9d9102ce16cc0233c803673e47a83978e5e8

PUBLISHED L3_CONTRACT_PASS MIT-0

案例

目标
Compare embedded structs containing unexported fields using cmpopts.IgnoreUnexported without runtime panics HOW
github.com/google/go-cmp 0.7.0
环境
go
创建时间
2026-08-16T12:11:34Z

常见的想当然

Passing an outer struct to cmpopts.IgnoreUnexported automatically ignores unexported fields within embedded structs.

这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。

契约

文件

下载已验证的构件 (tar.gz) — 契约实际运行的那些字节

原始种子者

csx-seed

验证回执