CodeSampleX

Sample

golang.org/x/text v0.43.0: language.French

Verified sample for golang golang.org/x/text v0.43.0: language.French. The contract ran on go 1.26 · linux debian/x64 · docker and passed.

sha256:aa15a9add2612bcd9cc9e65488d342f417bed6c0c5eeb1a033927fdd9d1b3a21

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 debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1golang:1.26@sha256:e30143be198a…
2026-10-17

Case

HOW
Goal
verify golang.org/x/text/language.French in pkg:golang/golang.org/x/text@v0.43.0
Packages
Symbols
  • golang.org/x/text/language.French
Created
2026-10-17T20:37:19Z

Contract

  1. language.French is a predefined Tag whose String representation equals 'fr' and equals language.Make('fr')
  2. language.French.Base returns Base 'fr' with Exact confidence
  3. language.French.Script infers Latin script 'Latn' with High confidence and Region infers 'FR' with Low confidence
  4. language.French.Parent returns Und root tag with IsRoot true
  5. language.NewMatcher with language.French matches French regional variants such as fr-CA and fr-BE to French

Files

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

Download the source artifact (tar.gz)

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 golang.org/x/text/language.French in pkg:golang/golang.org/x/text@v0.43.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/text@v0.43.0
Demonstrate these symbols/APIs:
  - golang.org/x/text/language.French

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:bc5ded9ad37f4d331a9c36cc7c257a3ae96570633e0ceddb0a6444cb0347df50","contract":["language.French is a predefined Tag whose String representation equals 'fr' and equals language.Make('fr')","language.French.Base returns Base 'fr' with Exact confidence","language.French.Script infers Latin script 'Latn' with High confidence and Region infers 'FR' with Low confidence","language.French.Parent returns Und root tag with IsRoot true","language.NewMatcher with language.French matches French regional variants such as fr-CA and fr-BE to French"],"goal":"verify golang.org/x/text/language.French in pkg:golang/golang.org/x/text@v0.43.0","kind":"HOW","packages":["pkg:golang/golang.org/x/text@v0.43.0"],"schemaVersion":1,"symbols":["golang.org/x/text/language.French"]},"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.43.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/text@v0.43.0","symbols":["golang.org/x/text/language.French"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.26.0

require golang.org/x/text v0.43.0
go.sum
golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc=
golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s=
main.go
package main

import (
	"fmt"

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

func main() {
	tag := language.French
	fmt.Printf("Tag: %s\n", tag.String())

	base, baseConf := tag.Base()
	script, scriptConf := tag.Script()
	region, regionConf := tag.Region()
	fmt.Printf("Base: %s (%s), Script: %s (%s), Region: %s (%s)\n",
		base, baseConf, script, scriptConf, region, regionConf)

	parent := tag.Parent()
	fmt.Printf("Parent of French: %s (is root: %t)\n", parent, parent.IsRoot())

	matcher := language.NewMatcher([]language.Tag{
		language.English,
		language.German,
		language.French,
	})

	matchedTag, index, conf := matcher.Match(language.Make("fr-CA"))
	fmt.Printf("Matched: %s at index %d with confidence %s\n", matchedTag, index, conf)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/text/language.French in pkg:golang/golang.org/x/text@v0.43.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/text@v0.43.0"
  ],
  "symbols": [
    "golang.org/x/text/language.French"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

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

func main() {
	// Assertion 1: language.French is a predefined Tag whose String representation equals "fr" and equals language.Make("fr")
	if tagStr := language.French.String(); tagStr != "fr" {
		fmt.Fprintf(os.Stderr, "FAIL: expected language.French.String() to be 'fr', got %q\n", tagStr)
		os.Exit(1)
	}
	if parsed := language.Make("fr"); parsed != language.French {
		fmt.Fprintf(os.Stderr, "FAIL: expected language.Make('fr') to equal language.French\n")
		os.Exit(1)
	}

	// Assertion 2: language.French.Base returns Base "fr" with Exact confidence
	base, baseConf := language.French.Base()
	if base.String() != "fr" {
		fmt.Fprintf(os.Stderr, "FAIL: expected base 'fr', got %q\n", base.String())
		os.Exit(1)
	}
	if baseConf != language.Exact {
		fmt.Fprintf(os.Stderr, "FAIL: expected Exact confidence for base, got %v\n", baseConf)
		os.Exit(1)
	}

	// Assertion 3: language.French.Script infers Latin script "Latn" with High confidence and Region infers "FR" with Low confidence
	script, scriptConf := language.French.Script()
	if script.String() != "Latn" {
		fmt.Fprintf(os.Stderr, "FAIL: expected script 'Latn', got %q\n", script.String())
		os.Exit(1)
	}
	if scriptConf != language.High {
		fmt.Fprintf(os.Stderr, "FAIL: expected High confidence for inferred script, got %v\n", scriptConf)
		os.Exit(1)
	}

	region, regionConf := language.French.Region()
	if region.String() != "FR" {
		fmt.Fprintf(os.Stderr, "FAIL: expected region 'FR', got %q\n", region.String())
		os.Exit(1)
	}
	if regionConf != language.Low {
		fmt.Fprintf(os.Stderr, "FAIL: expected Low confidence for inferred region, got %v\n", regionConf)
		os.Exit(1)
	}

	// Assertion 4: language.French.Parent returns Und root tag with IsRoot true
	parent := language.French.Parent()
	if parent != language.Und {
		fmt.Fprintf(os.Stderr, "FAIL: expected parent of French to be Und, got %v\n", parent)
		os.Exit(1)
	}
	if !parent.IsRoot() {
		fmt.Fprintf(os.Stderr, "FAIL: expected parent.IsRoot() to be true\n")
		os.Exit(1)
	}

	// Assertion 5: language.NewMatcher with language.French matches French regional variants such as fr-CA and fr-BE to French
	serverLangs := []language.Tag{
		language.English,
		language.German,
		language.French,
	}
	matcher := language.NewMatcher(serverLangs)

	frCA := language.Make("fr-CA")
	_, indexCA, confCA := matcher.Match(frCA)
	if serverLangs[indexCA] != language.French || indexCA != 2 {
		fmt.Fprintf(os.Stderr, "FAIL: expected fr-CA to select serverLangs[2] (French), got index %d\n", indexCA)
		os.Exit(1)
	}
	if confCA < language.High {
		fmt.Fprintf(os.Stderr, "FAIL: expected High or Exact confidence for fr-CA match, got %v\n", confCA)
		os.Exit(1)
	}

	frBE := language.Make("fr-BE")
	_, indexBE, confBE := matcher.Match(frBE)
	if serverLangs[indexBE] != language.French || indexBE != 2 {
		fmt.Fprintf(os.Stderr, "FAIL: expected fr-BE to select serverLangs[2] (French), got index %d\n", indexBE)
		os.Exit(1)
	}
	if confBE < language.High {
		fmt.Fprintf(os.Stderr, "FAIL: expected High or Exact confidence for fr-BE match, got %v\n", confBE)
		os.Exit(1)
	}

	if comp := language.Comprehends(frCA, language.French); comp < language.High {
		fmt.Fprintf(os.Stderr, "FAIL: expected High comprehension between fr-CA and French, got %v\n", comp)
		os.Exit(1)
	}

	fmt.Println("PASS: pkg:golang/golang.org/x/text@v0.43.0 language.French contract verified")
}

Origin Seeder

anonymous