Exemple
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443: v3.ResourceLocator_Scheme_name
Échantillon vérifié pour golang github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443: v3.ResourceLocator_Scheme_name. Le contrat s'est exécuté sur go…
sha256:0045e23aad67e3c0320097dfa3731121eacbcf2393facfa8b5839371cc76556a
Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré.
Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes.
MIT-0
Preuves d'exécution
L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.
- Base de preuve
- Contrat signé réussi
- Reçus de vérification
- 1
- Clés de signature qui l’ont compilé
- 1
Environnement déclaré
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Environnements des exécutions de vérification
| Environnement | Contrat | Étapes | Exécution |
|---|---|---|---|
| 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-10-10 |
Cas
HOW- Objectif
- verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name in pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443
- Symboles
-
- github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name
- Environnement
- go 1.26.6
- Créé
- 2026-10-10T00:46:58Z
Contrat
- ResourceLocator_Scheme_name maps enum value 0 to XDSTP string representation
- ResourceLocator_Scheme_name maps enum value 1 to HTTP string representation
- ResourceLocator_Scheme_name maps enum value 2 to FILE string representation
- ResourceLocator_Scheme_name contains exactly three entries corresponding to valid ResourceLocator_Scheme values
- ResourceLocator_Scheme String method returns the matching name from ResourceLocator_Scheme_name
- ResourceLocator_Scheme_name and ResourceLocator_Scheme_value provide consistent bidirectional enum mapping
Fichiers
- PROMPT.md
- csx.json
- go.mod
- go.sum
- spec.json
- test/main.go
Code 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/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name in pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443
Demonstrate these symbols/APIs:
- github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name
Required runtime conditions:
- ecosystem: golang
- language: go
- packageManager: go@1.26.6
- runtime: go@1.26.6
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:20bc1fefef8d8ca9e104bac0de6d7af581f7615bb5b6ea2fb2ec93dff1d12ff1","contract":["ResourceLocator_Scheme_name maps enum value 0 to XDSTP string representation","ResourceLocator_Scheme_name maps enum value 1 to HTTP string representation","ResourceLocator_Scheme_name maps enum value 2 to FILE string representation","ResourceLocator_Scheme_name contains exactly three entries corresponding to valid ResourceLocator_Scheme values","ResourceLocator_Scheme String method returns the matching name from ResourceLocator_Scheme_name","ResourceLocator_Scheme_name and ResourceLocator_Scheme_value provide consistent bidirectional enum mapping"],"goal":"verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name in pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443","kind":"HOW","packages":["pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443"],"schemaVersion":1,"symbols":["github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name"]},"contractCommand":["go","run","./test"],"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/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443"],"schemaVersion":1,"subject":"pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443","symbols":["github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name"],"verifierAdapter":"golang@1"}
module example.com/resourcelocatorschemename
go 1.23.0
require (
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443
google.golang.org/protobuf v1.33.0
)
require github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 h1:aQ3y1lwWyqYPiWZThqv1aFbZMiM9vblcSArJRf2Irls=
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=
github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
{
"schemaVersion": 1,
"goal": "verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name in pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443"
],
"symbols": [
"github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name"
],
"runtimeConditions": {
"ecosystem": "golang",
"language": "go",
"packageManager": "go@1.26.6",
"runtime": "go@1.26.6"
}
}
package main
import (
"fmt"
"os"
corev3 "github.com/cncf/xds/go/xds/core/v3"
)
func assert(condition bool, message string) {
if !condition {
fmt.Fprintf(os.Stderr, "assertion failed: %s\n", message)
os.Exit(1)
}
}
func main() {
// Assertion 1: ResourceLocator_Scheme_name maps enum value 0 to XDSTP string representation
{
name, ok := corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_XDSTP)]
assert(ok, "expected ResourceLocator_Scheme_name to contain key for ResourceLocator_XDSTP")
assert(name == "XDSTP", "expected ResourceLocator_Scheme_name[0] to be XDSTP")
assert(int32(corev3.ResourceLocator_XDSTP) == 0, "expected ResourceLocator_XDSTP to equal 0")
}
// Assertion 2: ResourceLocator_Scheme_name maps enum value 1 to HTTP string representation
{
name, ok := corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_HTTP)]
assert(ok, "expected ResourceLocator_Scheme_name to contain key for ResourceLocator_HTTP")
assert(name == "HTTP", "expected ResourceLocator_Scheme_name[1] to be HTTP")
assert(int32(corev3.ResourceLocator_HTTP) == 1, "expected ResourceLocator_HTTP to equal 1")
}
// Assertion 3: ResourceLocator_Scheme_name maps enum value 2 to FILE string representation
{
name, ok := corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_FILE)]
assert(ok, "expected ResourceLocator_Scheme_name to contain key for ResourceLocator_FILE")
assert(name == "FILE", "expected ResourceLocator_Scheme_name[2] to be FILE")
assert(int32(corev3.ResourceLocator_FILE) == 2, "expected ResourceLocator_FILE to equal 2")
}
// Assertion 4: ResourceLocator_Scheme_name contains exactly three entries corresponding to valid ResourceLocator_Scheme values
{
assert(len(corev3.ResourceLocator_Scheme_name) == 3, "expected ResourceLocator_Scheme_name to have exactly 3 entries")
_, okInvalidPos := corev3.ResourceLocator_Scheme_name[999]
assert(!okInvalidPos, "expected undefined positive enum key 999 to not exist in ResourceLocator_Scheme_name")
_, okInvalidNeg := corev3.ResourceLocator_Scheme_name[-1]
assert(!okInvalidNeg, "expected negative enum key -1 to not exist in ResourceLocator_Scheme_name")
}
// Assertion 5: ResourceLocator_Scheme String method returns the matching name from ResourceLocator_Scheme_name
{
assert(corev3.ResourceLocator_XDSTP.String() == corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_XDSTP)], "expected String() to match ResourceLocator_Scheme_name for XDSTP")
assert(corev3.ResourceLocator_HTTP.String() == corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_HTTP)], "expected String() to match ResourceLocator_Scheme_name for HTTP")
assert(corev3.ResourceLocator_FILE.String() == corev3.ResourceLocator_Scheme_name[int32(corev3.ResourceLocator_FILE)], "expected String() to match ResourceLocator_Scheme_name for FILE")
}
// Assertion 6: ResourceLocator_Scheme_name and ResourceLocator_Scheme_value provide consistent bidirectional enum mapping
{
assert(len(corev3.ResourceLocator_Scheme_name) == len(corev3.ResourceLocator_Scheme_value), "expected name and value maps to have the same size")
for val, name := range corev3.ResourceLocator_Scheme_name {
reverseVal, ok := corev3.ResourceLocator_Scheme_value[name]
assert(ok, fmt.Sprintf("expected ResourceLocator_Scheme_value to have key %s", name))
assert(reverseVal == val, fmt.Sprintf("expected roundtrip value for %s to be %d, got %d", name, val, reverseVal))
}
}
fmt.Println("PASS: all github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme_name contract assertions verified")
}
Seeder d'origine
anonyme