CodeSampleX

Exemple

golang.org/x/text v0.3.2

Échantillon vérifié pour golang golang.org/x/text v0.3.2. Le contrat s'est exécuté sur go 1.26 · linux debian/x64 · docker et a réussi.

sha256:585e1267ba8bfebf9133a059e57b267667e86db58390189c2216baf6ec5c0a7f

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-05

Cas

HOW
Objectif
verify pkg:golang/golang.org/x/text@v0.3.2
Paquets
Créé
2026-09-05T04:20:25Z

Contrat

  1. cases.Title title-cases words according to language conventions, capitalizing the first letter of each word and lowercasing the rest
  2. cases.Title with cases.NoLower preserves existing uppercase letters while title-casing word starts
  3. cases.Upper and cases.Lower handle locale-specific dotted and dotless I in Turkish
  4. cases.Title handles Dutch title-casing where 'ij' digraph is capitalized as 'IJ'
  5. cases.Fold performs Unicode case folding to canonicalize strings for case-insensitive matching

Fichiers

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Télécharger l’artefact source (tar.gz)

Code source

PROMPT.md
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.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/text@v0.3.2

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.
csx.json
{"case":{"caseId":"case:sha256:3f357327c3f7608ad151461b03f29f77341ad6fb583c637875c96a1eca4cf542","contract":["cases.Title title-cases words according to language conventions, capitalizing the first letter of each word and lowercasing the rest","cases.Title with cases.NoLower preserves existing uppercase letters while title-casing word starts","cases.Upper and cases.Lower handle locale-specific dotted and dotless I in Turkish","cases.Title handles Dutch title-casing where 'ij' digraph is capitalized as 'IJ'","cases.Fold performs Unicode case folding to canonicalize strings for case-insensitive matching"],"goal":"verify pkg:golang/golang.org/x/text@v0.3.2","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.3.2"],"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.2"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.3.2","verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.22

require golang.org/x/text v0.3.2
go.sum
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
main.go
package main

import (
	"fmt"

	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

func main() {
	// Standard English title casing
	enTitle := cases.Title(language.English)
	fmt.Printf("English title: %s\n", enTitle.String("the wind in the WILLOWS"))

	// Title casing preserving existing uppercase letters
	enTitleNoLower := cases.Title(language.English, cases.NoLower)
	fmt.Printf("English title (NoLower): %s\n", enTitleNoLower.String("the wind in the WILLOWS"))

	// Locale-specific uppercase and lowercase in Turkish
	trUpper := cases.Upper(language.Turkish)
	trLower := cases.Lower(language.Turkish)
	fmt.Printf("Turkish upper of 'istanbul': %s\n", trUpper.String("istanbul"))
	fmt.Printf("Turkish lower of 'ISTANBUL': %s\n", trLower.String("ISTANBUL"))

	// Dutch title-casing of the 'ij' digraph
	nlTitle := cases.Title(language.Dutch)
	fmt.Printf("Dutch title of 'ijsland': %s\n", nlTitle.String("ijsland"))

	// Unicode case folding for case-insensitive matching
	folder := cases.Fold()
	fmt.Printf("Folded 'Fluß': %s\n", folder.String("Fluß"))
	fmt.Printf("Folded 'FLUSS': %s\n", folder.String("FLUSS"))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/golang.org/x/text@v0.3.2",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/text@v0.3.2"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"golang.org/x/text/cases"
	"golang.org/x/text/language"
)

func main() {
	// Assertion 1: cases.Title title-cases words according to language conventions, capitalizing the first letter of each word and lowercasing the rest
	enTitle := cases.Title(language.English)
	got1 := enTitle.String("the wind in the WILLOWS")
	expected1 := "The Wind In The Willows"
	if got1 != expected1 {
		fmt.Fprintf(os.Stderr, "FAIL assertion 1: expected '%s', got '%s'\n", expected1, got1)
		os.Exit(1)
	}

	// Assertion 2: cases.Title with cases.NoLower preserves existing uppercase letters while title-casing word starts
	enTitleNoLower := cases.Title(language.English, cases.NoLower)
	got2 := enTitleNoLower.String("the wind in the WILLOWS")
	expected2 := "The Wind In The WILLOWS"
	if got2 != expected2 {
		fmt.Fprintf(os.Stderr, "FAIL assertion 2: expected '%s', got '%s'\n", expected2, got2)
		os.Exit(1)
	}

	// Assertion 3: cases.Upper and cases.Lower handle locale-specific dotted and dotless I in Turkish
	trUpper := cases.Upper(language.Turkish)
	got3Upper := trUpper.String("istanbul")
	expected3Upper := "İSTANBUL" // \u0130
	if got3Upper != expected3Upper {
		fmt.Fprintf(os.Stderr, "FAIL assertion 3: expected '%s', got '%s'\n", expected3Upper, got3Upper)
		os.Exit(1)
	}

	trLower := cases.Lower(language.Turkish)
	got3Lower := trLower.String("ISTANBUL")
	expected3Lower := "ıstanbul" // \u0131
	if got3Lower != expected3Lower {
		fmt.Fprintf(os.Stderr, "FAIL assertion 3: expected '%s', got '%s'\n", expected3Lower, got3Lower)
		os.Exit(1)
	}

	// Assertion 4: cases.Title handles Dutch title-casing where 'ij' digraph is capitalized as 'IJ'
	nlTitle := cases.Title(language.Dutch)
	got4 := nlTitle.String("ijsland")
	expected4 := "IJsland"
	if got4 != expected4 {
		fmt.Fprintf(os.Stderr, "FAIL assertion 4: expected '%s', got '%s'\n", expected4, got4)
		os.Exit(1)
	}

	// Assertion 5: cases.Fold performs Unicode case folding to canonicalize strings for case-insensitive matching
	folder := cases.Fold()
	folded1 := folder.String("Fluß")
	folded2 := folder.String("FLUSS")
	if folded1 != "fluss" || folded2 != "fluss" || folded1 != folded2 {
		fmt.Fprintf(os.Stderr, "FAIL assertion 5: expected both to fold to 'fluss', got '%s' and '%s'\n", folded1, folded2)
		os.Exit(1)
	}

	fmt.Println("Contract passed: all assertions verified successfully.")
}

Seeder d'origine

anonyme