CodeSampleX

Sample

golang.org/x/net v0.17.0: publicsuffix.PublicSuffix

Verified sample for golang golang.org/x/net v0.17.0: publicsuffix.PublicSuffix. The contract ran on go 1.26 · linux debian/x64 · docker and passed…

sha256:c4860f29aa3538853ba936628f3c45c430765d61ad9153a8ae88427844d83621

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-09-01

Case

HOW
Goal
verify publicsuffix.PublicSuffix in pkg:golang/golang.org/x/net@v0.17.0
Packages
Symbols
  • publicsuffix.PublicSuffix
Created
2026-09-01T01:53:45Z

Contract

  1. publicsuffix.PublicSuffix returns the top-level public suffix and true for ICANN-managed domains
  2. publicsuffix.PublicSuffix returns the multi-part public suffix and true for ccTLD second-level domains
  3. publicsuffix.PublicSuffix returns the private suffix and false for non-ICANN managed domains
  4. publicsuffix.PublicSuffix returns the unmanaged domain suffix and false for unrecognized top-level domains

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 publicsuffix.PublicSuffix in pkg:golang/golang.org/x/net@v0.17.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/net@v0.17.0
Demonstrate these symbols/APIs:
  - publicsuffix.PublicSuffix

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:076786116387d56d0c9c15d0515f0fea0dc6722d904394d5a2e7772c969e3731","contract":["publicsuffix.PublicSuffix returns the top-level public suffix and true for ICANN-managed domains","publicsuffix.PublicSuffix returns the multi-part public suffix and true for ccTLD second-level domains","publicsuffix.PublicSuffix returns the private suffix and false for non-ICANN managed domains","publicsuffix.PublicSuffix returns the unmanaged domain suffix and false for unrecognized top-level domains"],"goal":"verify publicsuffix.PublicSuffix in pkg:golang/golang.org/x/net@v0.17.0","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.17.0"],"schemaVersion":1,"symbols":["publicsuffix.PublicSuffix"]},"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/net@v0.17.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.17.0","symbols":["publicsuffix.PublicSuffix"],"verifierAdapter":"golang@1"}
go.mod
module example.com/sample

go 1.25.0

require golang.org/x/net v0.17.0
go.sum
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
main.go
package main

import (
	"fmt"

	"golang.org/x/net/publicsuffix"
)

// CheckPublicSuffix returns the public suffix and whether it is managed by ICANN.
func CheckPublicSuffix(domain string) (string, bool) {
	return publicsuffix.PublicSuffix(domain)
}

func main() {
	domain := "sub.example.com"
	suffix, icann := CheckPublicSuffix(domain)
	fmt.Printf("Domain: %s -> Suffix: %s (ICANN: %v)\n", domain, suffix, icann)

	customDomain := "user.github.io"
	suffix2, icann2 := CheckPublicSuffix(customDomain)
	fmt.Printf("Domain: %s -> Suffix: %s (ICANN: %v)\n", customDomain, suffix2, icann2)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify publicsuffix.PublicSuffix in pkg:golang/golang.org/x/net@v0.17.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/net@v0.17.0"
  ],
  "symbols": [
    "publicsuffix.PublicSuffix"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"golang.org/x/net/publicsuffix"
)

func main() {
	// Assertion 1: publicsuffix.PublicSuffix returns the top-level public suffix and true for ICANN-managed domains
	suffix1, icann1 := publicsuffix.PublicSuffix("www.example.com")
	if suffix1 != "com" || !icann1 {
		fmt.Fprintf(os.Stderr, "FAIL: expected ('com', true) for 'www.example.com', got (%q, %v)\n", suffix1, icann1)
		os.Exit(1)
	}

	// Assertion 2: publicsuffix.PublicSuffix returns the multi-part public suffix and true for ccTLD second-level domains
	suffix2, icann2 := publicsuffix.PublicSuffix("blog.example.co.uk")
	if suffix2 != "co.uk" || !icann2 {
		fmt.Fprintf(os.Stderr, "FAIL: expected ('co.uk', true) for 'blog.example.co.uk', got (%q, %v)\n", suffix2, icann2)
		os.Exit(1)
	}

	// Assertion 3: publicsuffix.PublicSuffix returns the private suffix and false for non-ICANN managed domains
	suffix3, icann3 := publicsuffix.PublicSuffix("user.github.io")
	if suffix3 != "github.io" || icann3 {
		fmt.Fprintf(os.Stderr, "FAIL: expected ('github.io', false) for 'user.github.io', got (%q, %v)\n", suffix3, icann3)
		os.Exit(1)
	}

	// Assertion 4: publicsuffix.PublicSuffix returns the unmanaged domain suffix and false for unrecognized top-level domains
	suffix4, icann4 := publicsuffix.PublicSuffix("test.unrecognizedlocal")
	if suffix4 != "unrecognizedlocal" || icann4 {
		fmt.Fprintf(os.Stderr, "FAIL: expected ('unrecognizedlocal', false) for 'test.unrecognizedlocal', got (%q, %v)\n", suffix4, icann4)
		os.Exit(1)
	}

	fmt.Println("PASS: publicsuffix.PublicSuffix contract verified")
}

Origin Seeder

anonymous