Exemplo
github.com/google/uuid v1.6.0: generate and parse UUID v4 using google uuid
Amostra verificada para golang github.com/google/uuid v1.6.0: generate and parse UUID v4 using google uuid. O contrato rodou em go 1.26 · linux alpine/x64 …
sha256:e8dbd063bf27ad16bbeaaef62313041501d6c7442f75262f8e51cd2b4a58dae4
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 2
- Chaves de assinatura que o compilaram
- 2
Ambiente declarado
windows 11 x64 go
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-19 |
| 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-09-07 |
Caso
HOW- Objetivo
- generate and parse UUID v4 using google uuid
- Pacotes
- Símbolos
-
- github.com/google/uuid.NewRandom
- github.com/google/uuid.Parse
- Criado
- 2026-08-19T04:23:04Z
Contrato
- uuid.NewRandom generates a random version 4 UUID with RFC4122 variant and nil error
- uuid.Parse parses a valid UUID string representation back to the matching UUID value
- uuid.Parse returns a non-nil error when given an invalid UUID string
Arquivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- sample.go
- spec.json
- test/contract.go
Código-fonte
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: generate and parse UUID v4 using google uuid
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/google/uuid@v1.6.0
Demonstrate these symbols/APIs:
- github.com/google/uuid.NewRandom
- github.com/google/uuid.Parse
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:10b002aa9a61d0f74b260f093b3831c8bd7cd6b3ce8f8f9966ba77a4bdc6af09","contract":["uuid.NewRandom generates a random version 4 UUID with RFC4122 variant and nil error","uuid.Parse parses a valid UUID string representation back to the matching UUID value","uuid.Parse returns a non-nil error when given an invalid UUID string"],"goal":"generate and parse UUID v4 using google uuid","kind":"HOW","packages":["pkg:golang/github.com/google/uuid@v1.6.0"],"schemaVersion":1,"symbols":["github.com/google/uuid.NewRandom","github.com/google/uuid.Parse"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","ecosystem":"golang","os":"windows","osVersionBucket":"11","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/google/uuid@v1.6.0"],"schemaVersion":1,"symbols":["github.com/google/uuid.NewRandom","github.com/google/uuid.Parse"],"verifierAdapter":"golang@1"}
module sample
go 1.22.0
require github.com/google/uuid v1.6.0
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
package sample
import (
"fmt"
"github.com/google/uuid"
)
// GenerateRandomUUID creates a new random (v4) UUID.
func GenerateRandomUUID() (uuid.UUID, error) {
u, err := uuid.NewRandom()
if err != nil {
return uuid.Nil, fmt.Errorf("generate random uuid: %w", err)
}
return u, nil
}
// ParseUUID parses a standard 36-character string representation of a UUID.
func ParseUUID(s string) (uuid.UUID, error) {
u, err := uuid.Parse(s)
if err != nil {
return uuid.Nil, fmt.Errorf("parse uuid: %w", err)
}
return u, nil
}
{
"schemaVersion": 1,
"goal": "generate and parse UUID v4 using google uuid",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/google/uuid@v1.6.0"
],
"symbols": [
"github.com/google/uuid.NewRandom",
"github.com/google/uuid.Parse"
]
}
package main
import (
"fmt"
"os"
"github.com/google/uuid"
"sample"
)
func main() {
// 1. Assert uuid.NewRandom generates a valid UUID v4
u, err := uuid.NewRandom()
if err != nil {
fmt.Fprintf(os.Stderr, "uuid.NewRandom failed: %v\n", err)
os.Exit(1)
}
if u.Version() != 4 {
fmt.Fprintf(os.Stderr, "expected UUID version 4, got %d\n", u.Version())
os.Exit(1)
}
if u.Variant() != uuid.RFC4122 {
fmt.Fprintf(os.Stderr, "expected RFC4122 variant, got %v\n", u.Variant())
os.Exit(1)
}
// 2. Assert uuid.Parse parses valid string representation
str := u.String()
parsed, err := uuid.Parse(str)
if err != nil {
fmt.Fprintf(os.Stderr, "uuid.Parse failed: %v\n", err)
os.Exit(1)
}
if parsed != u {
fmt.Fprintf(os.Stderr, "parsed UUID (%v) does not match original (%v)\n", parsed, u)
os.Exit(1)
}
// 3. Assert uuid.Parse rejects invalid string
if _, err := uuid.Parse("not-a-valid-uuid-string"); err == nil {
fmt.Fprintf(os.Stderr, "expected error parsing invalid uuid string, got nil\n")
os.Exit(1)
}
// 4. Assert helper functions in sample package
wrapped, err := sample.GenerateRandomUUID()
if err != nil {
fmt.Fprintf(os.Stderr, "sample.GenerateRandomUUID failed: %v\n", err)
os.Exit(1)
}
wrappedStr := wrapped.String()
parsedWrapped, err := sample.ParseUUID(wrappedStr)
if err != nil {
fmt.Fprintf(os.Stderr, "sample.ParseUUID failed: %v\n", err)
os.Exit(1)
}
if parsedWrapped != wrapped {
fmt.Fprintf(os.Stderr, "sample.ParseUUID mismatch: got %v, want %v\n", parsedWrapped, wrapped)
os.Exit(1)
}
fmt.Println("All assertions passed.")
}
Seeder de origem
anônimo