Sample
github.com/google/go-cmp v0.6.0: cmp.Options
Verified sample for golang github.com/google/go-cmp v0.6.0: cmp.Options. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:1c2dbdf457fba72c8d0b8366f50d41500a8eaa1b9ae447199975811aedd9c153
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-09-15 |
Case
HOW- Goal
- verify github.com/google/go-cmp/cmp.Options in pkg:golang/github.com/google/go-cmp@v0.6.0
- Packages
- Symbols
-
- github.com/google/go-cmp/cmp.Options
- Created
- 2026-09-15T23:18:28Z
Contract
- cmp.Options satisfies cmp.Option and combines multiple options into a single option
- cmp.Options applies each grouped option during comparison
- cmp.Options can be nested to combine option groups hierarchically
- empty cmp.Options functions as a no-op option preserving standard comparison
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/google/go-cmp/cmp.Options in pkg:golang/github.com/google/go-cmp@v0.6.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/google/go-cmp@v0.6.0
Demonstrate these symbols/APIs:
- github.com/google/go-cmp/cmp.Options
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:16ab0fc0a8ac878e42a243fff1824594adab05df7f022f5a716d73bf867578e5","contract":["cmp.Options satisfies cmp.Option and combines multiple options into a single option","cmp.Options applies each grouped option during comparison","cmp.Options can be nested to combine option groups hierarchically","empty cmp.Options functions as a no-op option preserving standard comparison"],"goal":"verify github.com/google/go-cmp/cmp.Options in pkg:golang/github.com/google/go-cmp@v0.6.0","kind":"HOW","packages":["pkg:golang/github.com/google/go-cmp@v0.6.0"],"schemaVersion":1,"symbols":["github.com/google/go-cmp/cmp.Options"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/google/go-cmp@v0.6.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/google/go-cmp@v0.6.0","symbols":["github.com/google/go-cmp/cmp.Options"],"verifierAdapter":"golang@1"}
module sample
go 1.22.0
require github.com/google/go-cmp v0.6.0
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
package main
import (
"fmt"
"math"
"strings"
"github.com/google/go-cmp/cmp"
)
type Config struct {
Name string
Scale float64
Debug bool
}
func main() {
// cmp.Options groups multiple comparison options into a reusable composite option.
opts := cmp.Options{
cmp.Transformer("CanonicalName", strings.ToLower),
cmp.Comparer(func(x, y float64) bool {
return math.Abs(x-y) < 1e-4
}),
}
cfg1 := Config{Name: "Production", Scale: 1.00002, Debug: true}
cfg2 := Config{Name: "production", Scale: 1.00001, Debug: true}
if cmp.Equal(cfg1, cfg2, opts) {
fmt.Println("Configurations match under cmp.Options bundle.")
} else {
fmt.Println("Configurations differ.")
}
}
{
"schemaVersion": 1,
"goal": "verify github.com/google/go-cmp/cmp.Options in pkg:golang/github.com/google/go-cmp@v0.6.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/google/go-cmp@v0.6.0"
],
"symbols": [
"github.com/google/go-cmp/cmp.Options"
]
}
package main
import (
"fmt"
"math"
"os"
"strings"
"github.com/google/go-cmp/cmp"
)
type Measurement struct {
Tag string
Value float64
Note string
}
func main() {
// Assertion 1: cmp.Options satisfies cmp.Option and combines multiple options into a single option
{
optTag := cmp.Transformer("NormalizeTag", strings.ToUpper)
optVal := cmp.Comparer(func(a, b float64) bool {
return math.Abs(a-b) < 1e-3
})
var group cmp.Option = cmp.Options{optTag, optVal}
if group == nil {
fmt.Fprintf(os.Stderr, "assertion 1 failed: cmp.Options should satisfy cmp.Option\n")
os.Exit(1)
}
m1 := Measurement{Tag: "temp", Value: 20.0001, Note: "exact"}
m2 := Measurement{Tag: "TEMP", Value: 20.0004, Note: "exact"}
if !cmp.Equal(m1, m2, group) {
fmt.Fprintf(os.Stderr, "assertion 1 failed: grouped options should match m1 and m2\n")
os.Exit(1)
}
}
// Assertion 2: cmp.Options applies each grouped option during comparison
{
ignoreNote := cmp.FilterPath(func(p cmp.Path) bool {
return p.Last().String() == ".Note"
}, cmp.Ignore())
normTag := cmp.Transformer("TrimTag", strings.TrimSpace)
opts := cmp.Options{ignoreNote, normTag}
m1 := Measurement{Tag: " pressure ", Value: 101.3, Note: "sensor A"}
m2 := Measurement{Tag: "pressure", Value: 101.3, Note: "sensor B"}
m3 := Measurement{Tag: "volume", Value: 101.3, Note: "sensor A"}
if !cmp.Equal(m1, m2, opts) {
fmt.Fprintf(os.Stderr, "assertion 2 failed: opts should ignore Note and trim Tag\n")
os.Exit(1)
}
if cmp.Equal(m1, m3, opts) {
fmt.Fprintf(os.Stderr, "assertion 2 failed: opts should not equate different tags\n")
os.Exit(1)
}
}
// Assertion 3: cmp.Options can be nested to combine option groups hierarchically
{
group1 := cmp.Options{
cmp.Transformer("NormalizeTag", strings.ToLower),
}
group2 := cmp.Options{
cmp.Comparer(func(a, b float64) bool {
return math.Abs(a-b) < 0.05
}),
}
nested := cmp.Options{group1, group2}
m1 := Measurement{Tag: "HUMIDITY", Value: 55.02, Note: "raw"}
m2 := Measurement{Tag: "humidity", Value: 55.04, Note: "raw"}
if !cmp.Equal(m1, m2, nested) {
fmt.Fprintf(os.Stderr, "assertion 3 failed: nested cmp.Options should apply all child options\n")
os.Exit(1)
}
}
// Assertion 4: empty cmp.Options functions as a no-op option preserving standard comparison
{
emptyOpts := cmp.Options{}
m1 := Measurement{Tag: "v1", Value: 10.0, Note: "ok"}
m2 := Measurement{Tag: "v1", Value: 10.0, Note: "ok"}
m3 := Measurement{Tag: "v1", Value: 10.5, Note: "ok"}
if !cmp.Equal(m1, m2, emptyOpts) {
fmt.Fprintf(os.Stderr, "assertion 4 failed: empty cmp.Options should match identical values\n")
os.Exit(1)
}
if cmp.Equal(m1, m3, emptyOpts) {
fmt.Fprintf(os.Stderr, "assertion 4 failed: empty cmp.Options should not match different values\n")
os.Exit(1)
}
}
fmt.Println("All contract assertions passed.")
}
Origin Seeder
anonymous