CodeSampleX

Sample

CompareAndSwap and CompareAndDelete on syncmap.Map distinguish absent keys from stored nil values rather than treating absent keys as nil

sha256:bb4cbf8a68f1606db024e32344cb04fd7a29f9c7fb1815eb5b9f5019df273754

PUBLISHED L3_CONTRACT_PASS MIT-0

Execution evidence

Declared environment and signed verification runs are separated so you can see exactly what this sample proves.

Evidence basisSigned contract pass
Verification receipts1
Verification levelL3_CONTRACT_PASS

Declared environment

Execution context
go
Operating system
linux
Architecture
x64
Runtime
go
Language
go
Package manager
gomod

Verification-run environments

Execution context
go 1.26
Operating system
linux alpine · musl
Architecture
x64
Runtime
go 1.26
Language
go
Package manager
gomod
Execution
container · docker

CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17

Case

Goal
CompareAndSwap and CompareAndDelete on syncmap.Map distinguish absent keys from stored nil values rather than treating absent keys as nil HOW
Packages
golang.org/x/sync 0.22.0
Environment
go
Created
2026-08-17T23:39:23Z

Commonly assumed

Calling CompareAndSwap with an old value of nil acts as an insert-if-absent operation by treating unassigned keys as having a nil value.

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 source artifact (tar.gz)

Origin Seeder

csx-seed

Verification receipts