Sample
golang.org/x/text v0.34.0: collate.New, currency.ParseISO, message.NewPrinter
Verified sample for golang golang.org/x/text v0.34.0: collate.New, currency.ParseISO, message.NewPrinter. The contract ran on go 1.26 · linux alpine/x64 …
sha256:c71e27206929b43aca63aa14c6c8150c8ae866b9022aff01c1822eae6366e362
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-24 |
Case
HOW- Goal
- verify pkg:golang/golang.org/x/text@v0.34.0
- Packages
- Symbols
-
- collate.New
- currency.ParseISO
- message.NewPrinter
- precis.UsernameCaseMapped
- search.New
- Created
- 2026-08-24T20:11:33Z
Contract
- collate.New creates locale-sensitive collator comparing strings according to language collation rules
- search.New and Matcher.CompileString perform locale-aware and case-insensitive substring searching
- message.NewPrinter formats localized messages and numbers with language catalogs
- currency.ParseISO resolves ISO-4217 currency units and creates currency amounts
- precis.UsernameCaseMapped enforces username profile canonicalization and case-insensitive comparison
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
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 pkg:golang/golang.org/x/text@v0.34.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/text@v0.34.0
Demonstrate these symbols/APIs:
- collate.New
- currency.ParseISO
- message.NewPrinter
- precis.UsernameCaseMapped
- search.New
Constraints:
- executionContext: node
Required runtime conditions:
- ecosystem: npm
- language: javascript
- moduleSystem: cjs
- packageManager: npm@10.9.8
- runtime: node@22.23.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.
{"case":{"caseId":"case:sha256:109e83e4b78be6c94ec199f8e6a5e551f56038379eb8ac24c5fe2b4f89b7bce5","contract":["collate.New creates locale-sensitive collator comparing strings according to language collation rules","search.New and Matcher.CompileString perform locale-aware and case-insensitive substring searching","message.NewPrinter formats localized messages and numbers with language catalogs","currency.ParseISO resolves ISO-4217 currency units and creates currency amounts","precis.UsernameCaseMapped enforces username profile canonicalization and case-insensitive comparison"],"goal":"verify pkg:golang/golang.org/x/text@v0.34.0","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.34.0"],"schemaVersion":1,"symbols":["collate.New","currency.ParseISO","message.NewPrinter","precis.UsernameCaseMapped","search.New"]},"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.34.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.34.0","symbols":["collate.New","currency.ParseISO","message.NewPrinter","precis.UsernameCaseMapped","search.New"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.24.0
require golang.org/x/text v0.34.0
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
package main
import (
"fmt"
"os"
"golang.org/x/text/collate"
"golang.org/x/text/currency"
"golang.org/x/text/language"
"golang.org/x/text/message"
"golang.org/x/text/search"
"golang.org/x/text/secure/precis"
)
// CompareLocalized compares two strings using locale-specific collation rules.
func CompareLocalized(tag language.Tag, a, b string) int {
c := collate.New(tag)
return c.CompareString(a, b)
}
// FindSubstring searches for pattern in text using locale-sensitive matcher.
func FindSubstring(tag language.Tag, patternStr, text string) (int, int) {
m := search.New(tag, search.IgnoreCase)
pattern := m.CompileString(patternStr)
return pattern.IndexString(text)
}
// FormatLocalizedMessage formats a greeting string with locale-specific number formatting.
func FormatLocalizedMessage(tag language.Tag, name string, amount float64) string {
p := message.NewPrinter(tag)
return p.Sprintf("Hello %s, balance: %.2f", name, amount)
}
// ParseCurrency parses an ISO-4217 code and returns its standard unit representation.
func ParseCurrency(iso string) (currency.Unit, error) {
return currency.ParseISO(iso)
}
// NormalizeUser applies PRECIS username profile normalization.
func NormalizeUser(raw string) (string, error) {
return precis.UsernameCaseMapped.String(raw)
}
func main() {
// Setup localized greeting message catalog
_ = message.SetString(language.German, "Hello %s, balance: %.2f", "Hallo %s, Kontostand: %.2f")
// 1. Collation
cmp := CompareLocalized(language.Swedish, "z", "ö")
fmt.Printf("Swedish collation comparison ('z' vs 'ö'): %d\n", cmp)
// 2. Search
start, end := FindSubstring(language.English, "world", "Hello World!")
fmt.Printf("Search match indices: %d..%d\n", start, end)
// 3. Message formatting
msgDE := FormatLocalizedMessage(language.German, "Alex", 1234.56)
fmt.Printf("German message: %s\n", msgDE)
// 4. Currency
unit, err := ParseCurrency("USD")
if err != nil {
fmt.Fprintf(os.Stderr, "Currency error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Parsed currency: %s\n", unit)
// 5. PRECIS username normalization
norm, err := NormalizeUser("Admin_User")
if err != nil {
fmt.Fprintf(os.Stderr, "PRECIS error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Normalized username: %s\n", norm)
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/text@v0.34.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/text@v0.34.0"
],
"symbols": [
"collate.New",
"currency.ParseISO",
"message.NewPrinter",
"precis.UsernameCaseMapped",
"search.New"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
package main
import (
"fmt"
"os"
"golang.org/x/text/collate"
"golang.org/x/text/currency"
"golang.org/x/text/language"
"golang.org/x/text/message"
"golang.org/x/text/search"
"golang.org/x/text/secure/precis"
)
func main() {
// Assertion 1: collate.New creates locale-sensitive collator comparing strings according to language collation rules
cSwedish := collate.New(language.Swedish)
cGerman := collate.New(language.German)
if cSwedish.CompareString("z", "ö") >= 0 {
fmt.Fprintf(os.Stderr, "FAIL: Swedish collation failed: 'z' should sort before 'ö'\n")
os.Exit(1)
}
if cGerman.CompareString("ö", "z") >= 0 {
fmt.Fprintf(os.Stderr, "FAIL: German collation failed: 'ö' should sort before 'z'\n")
os.Exit(1)
}
var buf collate.Buffer
key := cGerman.KeyFromString(&buf, "sample")
if len(key) == 0 {
fmt.Fprintf(os.Stderr, "FAIL: collate.KeyFromString produced empty sort key\n")
os.Exit(1)
}
// Assertion 2: search.New and Matcher.CompileString perform locale-aware and case-insensitive substring searching
matcher := search.New(language.English, search.IgnoreCase)
pattern := matcher.CompileString("world")
start, end := pattern.IndexString("Hello World!")
if start != 6 || end != 11 {
fmt.Fprintf(os.Stderr, "FAIL: search.IndexString mismatch: expected (6, 11), got (%d, %d)\n", start, end)
os.Exit(1)
}
if notFoundStart, _ := pattern.IndexString("Hello Universe!"); notFoundStart != -1 {
fmt.Fprintf(os.Stderr, "FAIL: search.IndexString should return -1 for unmatched text\n")
os.Exit(1)
}
// Assertion 3: message.NewPrinter formats localized messages and numbers with language catalogs
err := message.SetString(language.German, "Hello %s", "Hallo %s")
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: message.SetString error: %v\n", err)
os.Exit(1)
}
pDE := message.NewPrinter(language.German)
greeting := pDE.Sprintf("Hello %s", "Welt")
if greeting != "Hallo Welt" {
fmt.Fprintf(os.Stderr, "FAIL: message.Sprintf greeting mismatch: got %q\n", greeting)
os.Exit(1)
}
numDE := pDE.Sprintf("%.2f", 1234.56)
if numDE != "1.234,56" {
fmt.Fprintf(os.Stderr, "FAIL: German number formatting mismatch: got %q, expected '1.234,56'\n", numDE)
os.Exit(1)
}
pUS := message.NewPrinter(language.English)
numUS := pUS.Sprintf("%.2f", 1234.56)
if numUS != "1,234.56" {
fmt.Fprintf(os.Stderr, "FAIL: US number formatting mismatch: got %q, expected '1,234.56'\n", numUS)
os.Exit(1)
}
// Assertion 4: currency.ParseISO resolves ISO-4217 currency units and creates currency amounts
usd, err := currency.ParseISO("USD")
if err != nil || usd.String() != "USD" {
fmt.Fprintf(os.Stderr, "FAIL: currency.ParseISO('USD') failed: %v\n", err)
os.Exit(1)
}
eur, err := currency.ParseISO("EUR")
if err != nil || eur.String() != "EUR" {
fmt.Fprintf(os.Stderr, "FAIL: currency.ParseISO('EUR') failed: %v\n", err)
os.Exit(1)
}
amtUSD := usd.Amount(150.75)
if amtUSD.Currency() != usd {
fmt.Fprintf(os.Stderr, "FAIL: Amount.Currency mismatch for USD\n")
os.Exit(1)
}
// Assertion 5: precis.UsernameCaseMapped enforces username profile canonicalization and case-insensitive comparison
profile := precis.UsernameCaseMapped
normUser, err := profile.String("Admin_User")
if err != nil || normUser != "admin_user" {
fmt.Fprintf(os.Stderr, "FAIL: precis username normalization mismatch: %v, got %q\n", err, normUser)
os.Exit(1)
}
if !profile.Compare("Admin_User", "admin_user") {
fmt.Fprintf(os.Stderr, "FAIL: precis profile.Compare failed for case-equivalent usernames\n")
os.Exit(1)
}
fmt.Println("PASS: pkg:golang/golang.org/x/text@v0.34.0 contract verified")
}
Origin Seeder
anonymous