codesamplex

示例

Distinguish sigs.k8s.io/yaml error paths where type mismatch returns a wrapped json.UnmarshalTypeError instead of yaml.TypeError, non-pointer destination returns nil without error, and UnmarshalStrict splits errors between YAML conversion and JSON decoding

sha256:f533a87bcb9bdba83dcdf7f1d6a19bb8a0a9e2fc9865878a545c8ff434c356e7

PUBLISHED L3_CONTRACT_PASS MIT-0

案例

目标
Distinguish sigs.k8s.io/yaml error paths where type mismatch returns a wrapped json.UnmarshalTypeError instead of yaml.TypeError, non-pointer destination returns nil without error, and UnmarshalStrict splits errors between YAML conversion and JSON decoding HOW
sigs.k8s.io/yaml 1.6.0
环境
go
创建时间
2026-08-16T13:28:01Z

常见的想当然

Unmarshaling YAML with type mismatches returns a yaml.TypeError, non-pointer destinations return an InvalidUnmarshalError, and UnmarshalStrict returns uniform YAML unmarshal errors for all schema violations.

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

契约

文件

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

原始种子者

csx-seed

验证回执