CodeSampleX

Sample

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

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

sha256:748e40b90dbd9cb35d7b4ebbaf49cc5fb72ed26e185fee159479ffe3a2a5cfa6

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.Comprehends in pkg:golang/golang.org/x/text@v0.43.0
Packages
Symbols
  • golang.org/x/text/language.Comprehends
Created
2026-10-17T22:30:55Z

Contract

  1. language.Comprehends returns Confidence Exact for identical language tags
  2. language.Comprehends returns Confidence Exact when speaker matches alternative base language
  3. language.Comprehends returns Confidence High for mutually intelligible language variants
  4. language.Comprehends returns Confidence No for unrelated languages

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.Comprehends 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.Comprehends

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:ef4790ced9d92e713b5ee4e4e35b5d85666c61ac8dea1069f12c802e3e88ccd7","contract":["language.Comprehends returns Confidence Exact for identical language tags","language.Comprehends returns Confidence Exact when speaker matches alternative base language","language.Comprehends returns Confidence High for mutually intelligible language variants","language.Comprehends returns Confidence No for unrelated languages"],"goal":"verify golang.org/x/text/language.Comprehends 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.Comprehends"]},"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.Comprehends"],"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() {
	enUS := language.AmericanEnglish
	enGB := language.BritishEnglish
	fr := language.French

	fmt.Printf("Comprehends(en-US, en-US): %v\n", language.Comprehends(enUS, enUS))
	fmt.Printf("Comprehends(en-US, en-GB): %v\n", language.Comprehends(enUS, enGB))
	fmt.Printf("Comprehends(en-US, fr): %v\n", language.Comprehends(enUS, fr))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/text/language.Comprehends 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.Comprehends"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

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

func main() {
	// 1. language.Comprehends returns Confidence Exact for identical language tags
	enUS := language.AmericanEnglish
	if c := language.Comprehends(enUS, enUS); c != language.Exact {
		fmt.Fprintf(os.Stderr, "assertion 1 failed: expected Exact for identical tags, got %v\n", c)
		os.Exit(1)
	}
	frCA := language.MustParse("fr-CA")
	if c := language.Comprehends(frCA, frCA); c != language.Exact {
		fmt.Fprintf(os.Stderr, "assertion 1 failed: expected Exact for fr-CA vs fr-CA, got %v\n", c)
		os.Exit(1)
	}

	// 2. language.Comprehends returns Confidence Exact when speaker matches alternative base language
	en := language.English
	if c := language.Comprehends(enUS, en); c != language.Exact {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected Exact for en-US vs en, got %v\n", c)
		os.Exit(1)
	}
	if c := language.Comprehends(en, enUS); c != language.Exact {
		fmt.Fprintf(os.Stderr, "assertion 2 failed: expected Exact for en vs en-US, got %v\n", c)
		os.Exit(1)
	}

	// 3. language.Comprehends returns Confidence High for mutually intelligible language variants
	enGB := language.BritishEnglish
	if c := language.Comprehends(enUS, enGB); c != language.High {
		fmt.Fprintf(os.Stderr, "assertion 3 failed: expected High for en-US vs en-GB, got %v\n", c)
		os.Exit(1)
	}
	da := language.MustParse("da")
	nb := language.MustParse("nb")
	if c := language.Comprehends(da, nb); c != language.High {
		fmt.Fprintf(os.Stderr, "assertion 3 failed: expected High for da vs nb, got %v\n", c)
		os.Exit(1)
	}

	// 4. language.Comprehends returns Confidence No for unrelated languages
	fr := language.French
	if c := language.Comprehends(en, fr); c != language.No {
		fmt.Fprintf(os.Stderr, "assertion 4 failed: expected No for en vs fr, got %v\n", c)
		os.Exit(1)
	}
	de := language.German
	ja := language.Japanese
	if c := language.Comprehends(de, ja); c != language.No {
		fmt.Fprintf(os.Stderr, "assertion 4 failed: expected No for de vs ja, got %v\n", c)
		os.Exit(1)
	}
	if c := language.Comprehends(language.Und, en); c != language.No {
		fmt.Fprintf(os.Stderr, "assertion 4 failed: expected No for Und vs en, got %v\n", c)
		os.Exit(1)
	}

	fmt.Println("All contract assertions passed.")
}

Origin Seeder

anonymous