Exemplo
golang.org/x/text v0.3.8
Amostra verificada para golang golang.org/x/text v0.3.8. O contrato rodou em go 1.26 · linux debian/x64 · docker e passou: language.Parse parses valid BCP 47…
sha256:deb3048f30fbb61c6aa298c6c99ceca60edba5640ece6fa984ef8e56c056b061
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
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 go
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-29 |
Caso
HOW- Objetivo
- verify pkg:golang/golang.org/x/text@v0.3.8
- Pacotes
- Criado
- 2026-10-29T22:25:24Z
Contrato
- language.Parse parses valid BCP 47 language tags into a Tag
- language.Parse canonicalizes tag casing to standard BCP 47 format
- language.Parse extracts correct base language script and region from compound tags
- language.NewMatcher matches user preferences against supported tags
- language.Parse returns an error for invalid or ill-formed language tags
Arquivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.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: verify pkg:golang/golang.org/x/text@v0.3.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/text@v0.3.8
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:8f00b0e4650d43e716334660ad08185e07bcaf7a4070da55522f80e1aa2399e9","contract":["language.Parse parses valid BCP 47 language tags into a Tag","language.Parse canonicalizes tag casing to standard BCP 47 format","language.Parse extracts correct base language script and region from compound tags","language.NewMatcher matches user preferences against supported tags","language.Parse returns an error for invalid or ill-formed language tags"],"goal":"verify pkg:golang/golang.org/x/text@v0.3.8","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.3.8"],"schemaVersion":1},"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/golang.org/x/text@v0.3.8"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.3.8","verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require golang.org/x/text v0.3.8
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
package main
import (
"fmt"
"log"
"golang.org/x/text/language"
)
func main() {
tag, err := language.Parse("en-US")
if err != nil {
log.Fatalf("failed to parse en-US: %v", err)
}
fmt.Printf("Parsed tag: %s\n", tag)
base, _ := tag.Base()
region, _ := tag.Region()
fmt.Printf("Base: %s, Region: %s\n", base, region)
canonicalTag, err := language.Parse("fr-ca")
if err != nil {
log.Fatalf("failed to parse fr-ca: %v", err)
}
fmt.Printf("Canonicalized tag: %s\n", canonicalTag)
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/text@v0.3.8",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/text@v0.3.8"
]
}
package main
import (
"fmt"
"os"
"golang.org/x/text/language"
)
func main() {
if err := runTests(); err != nil {
fmt.Fprintf(os.Stderr, "Contract test failed: %v\n", err)
os.Exit(1)
}
fmt.Println("All contract assertions passed.")
}
func runTests() error {
// 1. language.Parse parses valid BCP 47 language tags into a Tag
{
tag, err := language.Parse("en")
if err != nil {
return fmt.Errorf("assertion 1 failed: language.Parse(\"en\") returned error: %w", err)
}
if tag.String() != "en" {
return fmt.Errorf("assertion 1 failed: expected \"en\", got %q", tag.String())
}
}
// 2. language.Parse canonicalizes tag casing to standard BCP 47 format
{
tag, err := language.Parse("en-us")
if err != nil {
return fmt.Errorf("assertion 2 failed: language.Parse(\"en-us\") returned error: %w", err)
}
if tag.String() != "en-US" {
return fmt.Errorf("assertion 2 failed: expected \"en-US\", got %q", tag.String())
}
}
// 3. language.Parse extracts correct base language script and region from compound tags
{
tag, err := language.Parse("zh-Hant-TW")
if err != nil {
return fmt.Errorf("assertion 3 failed: language.Parse(\"zh-Hant-TW\") returned error: %w", err)
}
base, _ := tag.Base()
if base.String() != "zh" {
return fmt.Errorf("assertion 3 failed: expected base \"zh\", got %q", base.String())
}
script, _ := tag.Script()
if script.String() != "Hant" {
return fmt.Errorf("assertion 3 failed: expected script \"Hant\", got %q", script.String())
}
region, _ := tag.Region()
if region.String() != "TW" {
return fmt.Errorf("assertion 3 failed: expected region \"TW\", got %q", region.String())
}
}
// 4. language.NewMatcher matches user preferences against supported tags
{
matcher := language.NewMatcher([]language.Tag{
language.AmericanEnglish,
language.BritishEnglish,
language.French,
})
tag, idx, conf := matcher.Match(language.Make("en-GB"))
if idx != 1 || conf != language.Exact || tag != language.BritishEnglish {
return fmt.Errorf("assertion 4 failed: unexpected match tag=%v idx=%d conf=%v", tag, idx, conf)
}
}
// 5. language.Parse returns an error for invalid or ill-formed language tags
{
if _, err := language.Parse("invalid---tag"); err == nil {
return fmt.Errorf("assertion 5 failed: expected error for \"invalid---tag\", got nil")
}
if _, err := language.Parse(""); err == nil {
return fmt.Errorf("assertion 5 failed: expected error for empty string, got nil")
}
}
return nil
}
Seeder de origem
anônimo