Beispiel
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
Verifiziertes Beispiel für golang golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc. Der Vertrag lief auf go 1.26 · linux alpine/x64 · docker und bestand.
sha256:5321d59561a7d43ab4215400e34488a5165c8423b5dbc60ec36e51ee79ac64f1
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-27 |
Fall
HOW- Ziel
- verify pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc
- Umgebung
- go 1.26.6
- Erstellt
- 2026-08-27T14:46:26Z
Contract
- maps.Keys extracts a slice containing all keys from a map
- maps.Values extracts a slice containing all values from a map
- maps.Clone creates a shallow copy of a map
- maps.Equal reports whether two maps contain identical key/value pairs
- maps.Copy copies all key/value pairs from src to dst
- maps.DeleteFunc deletes key/value pairs satisfying a predicate function
- slices.Sort sorts a slice of any ordered type in ascending order
- slices.BinarySearch searches for a target in a sorted slice and returns the index and presence flag
- slices.Contains and slices.Index locate elements within slices
- slices.Compact replaces consecutive runs of equal elements with a single copy
- constraints.Ordered type constraint permits type parameters supporting ordered comparison operators
Dateien
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- spec.json
Quelltext
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 pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.2
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.
package sample_test
import (
"reflect"
"sort"
"testing"
"golang.org/x/exp/constraints"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
)
// Min returns the minimum of two values of any ordered type.
func Min[T constraints.Ordered](a, b T) T {
if a < b {
return a
}
return b
}
// Clamp restricts a value to a given range [minVal, maxVal].
func Clamp[T constraints.Ordered](val, minVal, maxVal T) T {
if val < minVal {
return minVal
}
if val > maxVal {
return maxVal
}
return val
}
func TestMapsOperations(t *testing.T) {
original := map[string]int{
"apple": 10,
"banana": 20,
"cherry": 30,
}
// 1. maps.Keys
keys := maps.Keys(original)
sort.Strings(keys)
expectedKeys := []string{"apple", "banana", "cherry"}
if !reflect.DeepEqual(keys, expectedKeys) {
t.Fatalf("maps.Keys mismatch: got %v, want %v", keys, expectedKeys)
}
// 2. maps.Values
values := maps.Values(original)
sort.Ints(values)
expectedValues := []int{10, 20, 30}
if !reflect.DeepEqual(values, expectedValues) {
t.Fatalf("maps.Values mismatch: got %v, want %v", values, expectedValues)
}
// 3. maps.Clone
cloned := maps.Clone(original)
if !maps.Equal(original, cloned) {
t.Fatalf("maps.Clone did not create an equal map")
}
// Modify cloned to verify independence
cloned["date"] = 40
if maps.Equal(original, cloned) {
t.Fatalf("modifying cloned map affected equality check")
}
// 4. maps.Copy
dest := map[string]int{"elderberry": 50}
maps.Copy(dest, original)
if len(dest) != 4 || dest["apple"] != 10 || dest["elderberry"] != 50 {
t.Fatalf("maps.Copy failed: got %+v", dest)
}
// 5. maps.DeleteFunc
maps.DeleteFunc(cloned, func(k string, v int) bool {
return v >= 20
})
expectedRemaining := map[string]int{"apple": 10}
if !maps.Equal(cloned, expectedRemaining) {
t.Fatalf("maps.DeleteFunc failed: got %+v, want %+v", cloned, expectedRemaining)
}
}
func TestSlicesOperations(t *testing.T) {
// 1. slices.Sort
numbers := []int{50, 20, 80, 10, 40}
slices.Sort(numbers)
expectedSorted := []int{10, 20, 40, 50, 80}
if !slices.Equal(numbers, expectedSorted) {
t.Fatalf("slices.Sort mismatch: got %v, want %v", numbers, expectedSorted)
}
// 2. slices.BinarySearch
idx, found := slices.BinarySearch(numbers, 40)
if !found || idx != 2 {
t.Fatalf("slices.BinarySearch for 40 failed: found=%v, idx=%d (expected true, 2)", found, idx)
}
missingIdx, missingFound := slices.BinarySearch(numbers, 35)
if missingFound || missingIdx != 2 {
t.Fatalf("slices.BinarySearch for missing value failed: found=%v, idx=%d (expected false, 2)", missingFound, missingIdx)
}
// 3. slices.Contains and slices.Index
if !slices.Contains(numbers, 80) {
t.Fatalf("slices.Contains returned false for present element")
}
if slices.Index(numbers, 50) != 3 {
t.Fatalf("slices.Index returned incorrect index: %d", slices.Index(numbers, 50))
}
// 4. slices.Compact
duplicates := []int{1, 1, 2, 2, 2, 3, 4, 4, 5}
compacted := slices.Compact(duplicates)
expectedCompacted := []int{1, 2, 3, 4, 5}
if !slices.Equal(compacted, expectedCompacted) {
t.Fatalf("slices.Compact failed: got %v, want %v", compacted, expectedCompacted)
}
}
func TestConstraintsOrdered(t *testing.T) {
// Integers
if got := Min(15, 42); got != 15 {
t.Fatalf("Min(15, 42) = %d; want 15", got)
}
// Floats
if got := Min(3.14, 2.71); got != 2.71 {
t.Fatalf("Min(3.14, 2.71) = %f; want 2.71", got)
}
// Strings
if got := Min("banana", "apple"); got != "apple" {
t.Fatalf("Min(\"banana\", \"apple\") = %s; want apple", got)
}
// Clamp
if got := Clamp(5, 10, 20); got != 10 {
t.Fatalf("Clamp(5, 10, 20) = %d; want 10", got)
}
if got := Clamp(25, 10, 20); got != 20 {
t.Fatalf("Clamp(25, 10, 20) = %d; want 20", got)
}
if got := Clamp(15, 10, 20); got != 15 {
t.Fatalf("Clamp(15, 10, 20) = %d; want 15", got)
}
}
{"case":{"caseId":"case:sha256:2b35704c53c0e91d8a665b22b62640786981c7b7df9cc4e96dc7f10c0a7d427f","contract":["maps.Keys extracts a slice containing all keys from a map","maps.Values extracts a slice containing all values from a map","maps.Clone creates a shallow copy of a map","maps.Equal reports whether two maps contain identical key/value pairs","maps.Copy copies all key/value pairs from src to dst","maps.DeleteFunc deletes key/value pairs satisfying a predicate function","slices.Sort sorts a slice of any ordered type in ascending order","slices.BinarySearch searches for a target in a sorted slice and returns the index and presence flag","slices.Contains and slices.Index locate elements within slices","slices.Compact replaces consecutive runs of equal elements with a single copy","constraints.Ordered type constraint permits type parameters supporting ordered comparison operators"],"goal":"verify pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc","kind":"HOW","packages":["pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc"],"schemaVersion":1},"contractCommand":["go","test","-v","./..."],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc","verifierAdapter":"golang@1"}
module sample
go 1.26.0
require golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/exp@v0.0.0-20230515195305-f3d0a9c9a5cc"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
Ursprungs-Seeder
anonym