Exemplo
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546
Amostra verificada para golang golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546. O contrato rodou em go 1.26 · linux alpine/x64 · docker e passou.
sha256:4f8750cf652718fc27cfb2e74f20593e1fb969210d69c3447a2c0580e12e337e
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
go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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-08-28 |
Caso
HOW- Objetivo
- verify pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546
- Ambiente
- go 1.26.6
- Criado
- 2026-08-28T10:36:38Z
Contrato
- utf8string.NewString creates a String wrapper and String() returns the underlying UTF-8 string
- String.RuneCount reports the number of Unicode code points rather than byte count
- String.IsASCII reports true for ASCII-only strings and false for multi-byte Unicode strings
- String.At retrieves the rune at the specified code point index with correct multi-byte decoding
- String.Slice extracts substrings by rune boundary indices [i:j]
- String.Init resets and initializes an existing String instance with new contents
- String.At and String.Slice panic on invalid out-of-range index arguments
Arquivos
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- spec.json
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/exp@v0.0.0-20251023183803-a4bb9ffd2546
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546
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.
package sample_test
import (
"testing"
"golang.org/x/exp/utf8string"
)
func TestASCIIStringOperations(t *testing.T) {
str := "Hello, World!"
s := utf8string.NewString(str)
if got := s.String(); got != str {
t.Fatalf("s.String() = %q; want %q", got, str)
}
if got := s.RuneCount(); got != 13 {
t.Fatalf("s.RuneCount() = %d; want 13", got)
}
if !s.IsASCII() {
t.Fatalf("s.IsASCII() = false; want true")
}
if got := s.At(0); got != 'H' {
t.Fatalf("s.At(0) = %q; want 'H'", got)
}
if got := s.At(7); got != 'W' {
t.Fatalf("s.At(7) = %q; want 'W'", got)
}
if got := s.At(12); got != '!' {
t.Fatalf("s.At(12) = %q; want '!'", got)
}
if got := s.Slice(0, 5); got != "Hello" {
t.Fatalf("s.Slice(0, 5) = %q; want %q", got, "Hello")
}
if got := s.Slice(7, 12); got != "World" {
t.Fatalf("s.Slice(7, 12) = %q; want %q", got, "World")
}
if got := s.Slice(0, 0); got != "" {
t.Fatalf("s.Slice(0, 0) = %q; want empty string", got)
}
}
func TestMultiByteUTF8Operations(t *testing.T) {
multibyte := "Hello, 世界! 🚀"
s := utf8string.NewString(multibyte)
if got := s.String(); got != multibyte {
t.Fatalf("s.String() = %q; want %q", got, multibyte)
}
// 7 ASCII + 2 CJK + 2 ASCII + 1 Emoji = 12 runes
if got := s.RuneCount(); got != 12 {
t.Fatalf("s.RuneCount() = %d; want 12", got)
}
if s.IsASCII() {
t.Fatalf("s.IsASCII() = true; want false")
}
expectedRunes := []rune{'H', 'e', 'l', 'l', 'o', ',', ' ', '世', '界', '!', ' ', '🚀'}
for i, want := range expectedRunes {
if got := s.At(i); got != want {
t.Fatalf("s.At(%d) = %q (U+%04X); want %q (U+%04X)", i, got, got, want, want)
}
}
if got := s.Slice(7, 9); got != "世界" {
t.Fatalf("s.Slice(7, 9) = %q; want %q", got, "世界")
}
if got := s.Slice(0, 7); got != "Hello, " {
t.Fatalf("s.Slice(0, 7) = %q; want %q", got, "Hello, ")
}
if got := s.Slice(9, 12); got != "! 🚀" {
t.Fatalf("s.Slice(9, 12) = %q; want %q", got, "! 🚀")
}
if got := s.Slice(11, 12); got != "🚀" {
t.Fatalf("s.Slice(11, 12) = %q; want %q", got, "🚀")
}
}
func TestBidirectionalAndRandomAccess(t *testing.T) {
s := utf8string.NewString("alpha, beta, gamma: αβγ 123")
expected := []rune("alpha, beta, gamma: αβγ 123")
// Backward scan
for i := len(expected) - 1; i >= 0; i-- {
if got := s.At(i); got != expected[i] {
t.Fatalf("backward scan s.At(%d) = %q; want %q", i, got, expected[i])
}
}
// Random jump access
indices := []int{20, 2, 21, 0, 19, 25, 5, 22}
for _, idx := range indices {
if got := s.At(idx); got != expected[idx] {
t.Fatalf("random jump s.At(%d) = %q; want %q", idx, got, expected[idx])
}
}
}
func TestInitReusability(t *testing.T) {
var s utf8string.String
s.Init("Go 언어")
if got := s.RuneCount(); got != 5 {
t.Fatalf("s.RuneCount() = %d; want 5", got)
}
if s.IsASCII() {
t.Fatalf("s.IsASCII() = true; want false")
}
if got := s.At(3); got != '언' {
t.Fatalf("s.At(3) = %q; want '언'", got)
}
if got := s.Slice(0, 2); got != "Go" {
t.Fatalf("s.Slice(0, 2) = %q; want %q", got, "Go")
}
// Reinitialize with ASCII string
s.Init("golang")
if got := s.RuneCount(); got != 6 {
t.Fatalf("re-init s.RuneCount() = %d; want 6", got)
}
if !s.IsASCII() {
t.Fatalf("re-init s.IsASCII() = false; want true")
}
if got := s.String(); got != "golang" {
t.Fatalf("re-init s.String() = %q; want %q", got, "golang")
}
}
func TestPanicConditions(t *testing.T) {
s := utf8string.NewString("test 世界")
assertPanic := func(name string, fn func()) {
defer func() {
if r := recover(); r == nil {
t.Fatalf("%s expected panic, but did not panic", name)
}
}()
fn()
}
assertPanic("At negative index", func() {
s.At(-1)
})
assertPanic("At index equal to rune count", func() {
s.At(s.RuneCount())
})
assertPanic("Slice inverted indices", func() {
s.Slice(4, 2)
})
assertPanic("Slice end index beyond rune count", func() {
s.Slice(0, s.RuneCount()+1)
})
}
{"case":{"caseId":"case:sha256:6a3698fa28e1b800c5dbec505fd5e649746635cbbc74bdb23952e64d5a21be5b","contract":["utf8string.NewString creates a String wrapper and String() returns the underlying UTF-8 string","String.RuneCount reports the number of Unicode code points rather than byte count","String.IsASCII reports true for ASCII-only strings and false for multi-byte Unicode strings","String.At retrieves the rune at the specified code point index with correct multi-byte decoding","String.Slice extracts substrings by rune boundary indices [i:j]","String.Init resets and initializes an existing String instance with new contents","String.At and String.Slice panic on invalid out-of-range index arguments"],"goal":"verify pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546","kind":"HOW","packages":["pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546"],"schemaVersion":1},"contractCommand":["go","test","-v","./..."],"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/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546","verifierAdapter":"golang@1"}
module sample
go 1.24.0
require golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 h1:mgKeJMpvi0yx/sU5GsxQ7p6s2wtOnGAHZWCHUM4KGzY=
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/exp@v0.0.0-20251023183803-a4bb9ffd2546"
],
"runtimeConditions": {
"ecosystem": "golang",
"language": "go",
"packageManager": "go@1.26.6",
"runtime": "go@1.26.6"
}
}
Seeder de origem
anônimo