Exemple
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74: None
Échantillon vérifié pour golang github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74: None. Le contrat s'est exécuté sur go 1.26 · linux…
sha256:4de3624efed7a1cd98187a8a446c975a5ec57b0b230fd170374be312e98e670c
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é
linux 24 · ubuntu · glibc 2.39 x64 go
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-09-03 |
Cas
HOW- Objectif
- verify github.com/vishvananda/netns.None in pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74
- Symboles
-
- github.com/vishvananda/netns.None
- Créé
- 2026-09-03T04:10:13Z
Contrat
- netns.None returns a sentinel NsHandle with file descriptor value -1
- netns.None sentinel reports IsOpen as false
- netns.None returns "NS(none)" from UniqueId and "NS(None)" from String
- netns.None equals another netns.None handle but does not equal an active namespace handle
- netns.Set fails with an error when called with netns.None
Fichiers
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.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/vishvananda/netns.None in pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74
Demonstrate these symbols/APIs:
- github.com/vishvananda/netns.None
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:c7b469a763711708c28463e38c3a5d7ebdfff18b662db35b1e51b195538d3b25","contract":["netns.None returns a sentinel NsHandle with file descriptor value -1","netns.None sentinel reports IsOpen as false","netns.None returns \"NS(none)\" from UniqueId and \"NS(None)\" from String","netns.None equals another netns.None handle but does not equal an active namespace handle","netns.Set fails with an error when called with netns.None"],"goal":"verify github.com/vishvananda/netns.None in pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74","kind":"HOW","packages":["pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74"],"schemaVersion":1,"symbols":["github.com/vishvananda/netns.None"]},"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/vishvananda/netns@v0.0.0-20211101163701-50045581ed74"],"schemaVersion":1,"subject":"pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74","symbols":["github.com/vishvananda/netns.None"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74
require golang.org/x/sys v0.2.0 // indirect
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 h1:gga7acRE695APm9hlsSMoOoE65U4/TcqNj90mc69Rlg=
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
package main
import (
"fmt"
"os"
"github.com/vishvananda/netns"
)
// DemonstrateSentinelUsage prints the characteristics of netns.None().
func DemonstrateSentinelUsage() {
none := netns.None()
fmt.Printf("Sentinel handle descriptor: %d\n", int(none))
fmt.Printf("Is sentinel handle open: %v\n", none.IsOpen())
fmt.Printf("Sentinel UniqueId: %s\n", none.UniqueId())
fmt.Printf("Sentinel String representation: %s\n", none.String())
}
func main() {
DemonstrateSentinelUsage()
none := netns.None()
if none.IsOpen() {
fmt.Fprintf(os.Stderr, "Error: None handle must not be open\n")
os.Exit(1)
}
anotherNone := netns.None()
if !none.Equal(anotherNone) {
fmt.Fprintf(os.Stderr, "Error: None handles must be equal to each other\n")
os.Exit(1)
}
err := netns.Set(none)
if err == nil {
fmt.Fprintf(os.Stderr, "Error: setting netns.None should fail\n")
os.Exit(1)
}
fmt.Println("Demonstration finished successfully")
}
{
"schemaVersion": 1,
"goal": "verify github.com/vishvananda/netns.None in pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/vishvananda/netns@v0.0.0-20211101163701-50045581ed74"
],
"symbols": [
"github.com/vishvananda/netns.None"
]
}
package main
import (
"fmt"
"os"
"github.com/vishvananda/netns"
)
func main() {
// Assertion 1: netns.None returns a sentinel NsHandle with file descriptor value -1
none := netns.None()
if int(none) != -1 {
fmt.Fprintf(os.Stderr, "FAIL: expected netns.None() to have int value -1, got %d\n", int(none))
os.Exit(1)
}
// Assertion 2: netns.None sentinel reports IsOpen as false
if none.IsOpen() {
fmt.Fprintf(os.Stderr, "FAIL: expected netns.None().IsOpen() to be false, got true\n")
os.Exit(1)
}
// Assertion 3: netns.None returns "NS(none)" from UniqueId and "NS(None)" from String
if uid := none.UniqueId(); uid != "NS(none)" {
fmt.Fprintf(os.Stderr, "FAIL: expected netns.None().UniqueId() == \"NS(none)\", got %q\n", uid)
os.Exit(1)
}
if str := none.String(); str != "NS(None)" {
fmt.Fprintf(os.Stderr, "FAIL: expected netns.None().String() == \"NS(None)\", got %q\n", str)
os.Exit(1)
}
// Assertion 4: netns.None equals another netns.None handle but does not equal an active namespace handle
secondNone := netns.None()
if !none.Equal(secondNone) {
fmt.Fprintf(os.Stderr, "FAIL: expected two netns.None handles to be equal\n")
os.Exit(1)
}
curNs, err := netns.Get()
if err == nil {
defer curNs.Close()
if none.Equal(curNs) {
fmt.Fprintf(os.Stderr, "FAIL: netns.None must not equal an open namespace handle\n")
os.Exit(1)
}
if curNs.Equal(none) {
fmt.Fprintf(os.Stderr, "FAIL: open namespace handle must not equal netns.None\n")
os.Exit(1)
}
}
// Assertion 5: netns.Set fails with an error when called with netns.None
if err := netns.Set(none); err == nil {
fmt.Fprintf(os.Stderr, "FAIL: expected netns.Set(netns.None()) to fail, but succeeded\n")
os.Exit(1)
}
fmt.Println("PASS: netns.None contract passed")
}
Seeder d'origine
anonyme