Beispiel
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443: v3.ResourceLocator_Scheme
Verifiziertes Beispiel für golang github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443: v3.ResourceLocator_Scheme. Der Vertrag lief auf go 1.26 · linux…
sha256:0965e9bfd83ecc3449d267d6ecd37a16befb093a2b1233dc95613156e50cf416
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 debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a… |
2026-10-09 |
Fall
HOW- Ziel
- verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme in pkg:golang/github.com/cncf/xds/go@v0.0.0-20250501225837-2ac532fd4443
- Symbole
-
- github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme
- Umgebung
- go 1.26.6
- Erstellt
- 2026-10-09T21:36:52Z
Contract
- ResourceLocator_Scheme enum constants evaluate to expected integer values 0 for XDSTP, 1 for HTTP, and 2 for FILE
- ResourceLocator_Scheme String method returns the protobuf identifier names XDSTP, HTTP, and FILE
- ResourceLocator_Scheme_name and ResourceLocator_Scheme_value maps correctly convert between enum values and strings
- ResourceLocator GetScheme returns the configured ResourceLocator_Scheme or default XDSTP when unset or nil
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
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 github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme 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
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:ebb2773d0dc8041cb3ac3c17943c5bae6b3cfe25c8ad72bb38fc96d6861342ca","contract":["ResourceLocator_Scheme enum constants evaluate to expected integer values 0 for XDSTP, 1 for HTTP, and 2 for FILE","ResourceLocator_Scheme String method returns the protobuf identifier names XDSTP, HTTP, and FILE","ResourceLocator_Scheme_name and ResourceLocator_Scheme_value maps correctly convert between enum values and strings","ResourceLocator GetScheme returns the configured ResourceLocator_Scheme or default XDSTP when unset or nil"],"goal":"verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme 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"]},"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"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443
require (
github.com/envoyproxy/protoc-gen-validate v1.0.4 // indirect
google.golang.org/protobuf v1.33.0 // 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=
package main
import (
"fmt"
v3 "github.com/cncf/xds/go/xds/core/v3"
)
func main() {
xdstpScheme := v3.ResourceLocator_XDSTP
httpScheme := v3.ResourceLocator_HTTP
fileScheme := v3.ResourceLocator_FILE
fmt.Printf("Scheme values: XDSTP=%d (%s), HTTP=%d (%s), FILE=%d (%s)\n",
xdstpScheme, xdstpScheme.String(),
httpScheme, httpScheme.String(),
fileScheme, fileScheme.String(),
)
locator := &v3.ResourceLocator{
Scheme: v3.ResourceLocator_XDSTP,
Authority: "example.com",
ResourceType: "envoy.config.cluster.v3.Cluster",
Id: "service-cluster",
}
fmt.Printf("Configured ResourceLocator Scheme: %s (number: %d)\n",
locator.GetScheme().String(),
locator.GetScheme().Number(),
)
}
{
"schemaVersion": 1,
"goal": "verify github.com/cncf/xds/go/xds/core/v3.ResourceLocator_Scheme 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"
]
}
package main
import (
"fmt"
"os"
v3 "github.com/cncf/xds/go/xds/core/v3"
)
func main() {
// Assertion 1: ResourceLocator_Scheme enum constants evaluate to expected integer values 0 for XDSTP, 1 for HTTP, and 2 for FILE
{
if v3.ResourceLocator_XDSTP != 0 || v3.ResourceLocator_HTTP != 1 || v3.ResourceLocator_FILE != 2 {
fmt.Fprintf(os.Stderr, "assertion 1 failed: enum integer values mismatch\n")
os.Exit(1)
}
if v3.ResourceLocator_XDSTP.Number() != 0 || v3.ResourceLocator_HTTP.Number() != 1 || v3.ResourceLocator_FILE.Number() != 2 {
fmt.Fprintf(os.Stderr, "assertion 1 failed: enum Number() return values mismatch\n")
os.Exit(1)
}
}
// Assertion 2: ResourceLocator_Scheme String method returns the protobuf identifier names XDSTP, HTTP, and FILE
{
if v3.ResourceLocator_XDSTP.String() != "XDSTP" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: XDSTP string mismatch, got %q\n", v3.ResourceLocator_XDSTP.String())
os.Exit(1)
}
if v3.ResourceLocator_HTTP.String() != "HTTP" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: HTTP string mismatch, got %q\n", v3.ResourceLocator_HTTP.String())
os.Exit(1)
}
if v3.ResourceLocator_FILE.String() != "FILE" {
fmt.Fprintf(os.Stderr, "assertion 2 failed: FILE string mismatch, got %q\n", v3.ResourceLocator_FILE.String())
os.Exit(1)
}
}
// Assertion 3: ResourceLocator_Scheme_name and ResourceLocator_Scheme_value maps correctly convert between enum values and strings
{
if v3.ResourceLocator_Scheme_name[0] != "XDSTP" || v3.ResourceLocator_Scheme_name[1] != "HTTP" || v3.ResourceLocator_Scheme_name[2] != "FILE" {
fmt.Fprintf(os.Stderr, "assertion 3 failed: ResourceLocator_Scheme_name map values mismatch\n")
os.Exit(1)
}
if v3.ResourceLocator_Scheme_value["XDSTP"] != 0 || v3.ResourceLocator_Scheme_value["HTTP"] != 1 || v3.ResourceLocator_Scheme_value["FILE"] != 2 {
fmt.Fprintf(os.Stderr, "assertion 3 failed: ResourceLocator_Scheme_value map values mismatch\n")
os.Exit(1)
}
}
// Assertion 4: ResourceLocator GetScheme returns the configured ResourceLocator_Scheme or default XDSTP when unset or nil
{
loc := &v3.ResourceLocator{Scheme: v3.ResourceLocator_HTTP}
if loc.GetScheme() != v3.ResourceLocator_HTTP {
fmt.Fprintf(os.Stderr, "assertion 4 failed: GetScheme on configured locator failed\n")
os.Exit(1)
}
emptyLoc := &v3.ResourceLocator{}
if emptyLoc.GetScheme() != v3.ResourceLocator_XDSTP {
fmt.Fprintf(os.Stderr, "assertion 4 failed: GetScheme on empty locator should default to XDSTP\n")
os.Exit(1)
}
var nilLoc *v3.ResourceLocator
if nilLoc.GetScheme() != v3.ResourceLocator_XDSTP {
fmt.Fprintf(os.Stderr, "assertion 4 failed: GetScheme on nil locator should return XDSTP\n")
os.Exit(1)
}
}
fmt.Println("All ResourceLocator_Scheme contract assertions passed successfully.")
}
Ursprungs-Seeder
anonym