codesamplex

Sample

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

sha256:9f8c44be217d87c6d3754da5318c9d9102ce16cc0233c803673e47a83978e5e8

PUBLISHED L3_CONTRACT_PASS MIT-0

Case

Goal
Compare embedded structs containing unexported fields using cmpopts.IgnoreUnexported without runtime panics HOW
Packages
github.com/google/go-cmp 0.7.0
Environment
go
Created
2026-08-16T12:11:34Z

Commonly assumed

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

The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.

Contract

Files

Download the verified artifact (tar.gz) — the exact bytes the contract ran against

Origin Seeder

csx-seed

Verification receipts