CodeSampleX

Sample

golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914: html.DoctypeToken

Verified sample for golang golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914: html.DoctypeToken. The contract ran on go 1.26 · linux debian/x64 · docker…

sha256:2f546a1bd67e78a2f76cb03c960845a40d21989422e5189e57e2f242b4697abe

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

Case

HOW
Goal
verify golang.org/x/net/html.DoctypeToken in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
Packages
Symbols
  • golang.org/x/net/html.DoctypeToken
Created
2026-10-28T21:50:30Z

Contract

  1. html.DoctypeToken.String() returns "Doctype"
  2. html.NewTokenizer emits html.DoctypeToken when advancing over <!DOCTYPE html>
  3. Token.Type equals html.DoctypeToken and Token.Data equals "html" for an HTML5 doctype declaration
  4. Subsequent element tags emit html.StartTagToken rather than html.DoctypeToken

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • 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/net/html.DoctypeToken in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914
Demonstrate these symbols/APIs:
  - golang.org/x/net/html.DoctypeToken

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:d7a2e2311154aa5e2ccb56b25d611696cf20af6c71f4691e4f54b7d49821c8da","contract":["html.DoctypeToken.String() returns \"Doctype\"","html.NewTokenizer emits html.DoctypeToken when advancing over \u003c!DOCTYPE html\u003e","Token.Type equals html.DoctypeToken and Token.Data equals \"html\" for an HTML5 doctype declaration","Subsequent element tags emit html.StartTagToken rather than html.DoctypeToken"],"goal":"verify golang.org/x/net/html.DoctypeToken in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914"],"schemaVersion":1,"symbols":["golang.org/x/net/html.DoctypeToken"]},"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.0.0-20191119073136-fc4aabc6c914"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914","symbols":["golang.org/x/net/html.DoctypeToken"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.20

require golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914
go.sum
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914 h1:MlY3mEfbnWGmUi4rtHOtNnnnN4UJRGSyLPx+DXA5Sq4=
golang.org/x/net v0.0.0-20191119073136-fc4aabc6c914/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/net/html.DoctypeToken in pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914",
  "kind": "HOW",
  "packages": [
    "pkg:golang/golang.org/x/net@v0.0.0-20191119073136-fc4aabc6c914"
  ],
  "symbols": [
    "golang.org/x/net/html.DoctypeToken"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"
	"strings"

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

func main() {
	// 1. Verify DoctypeToken string representation and constant identity
	if html.DoctypeToken.String() != "Doctype" {
		fmt.Fprintf(os.Stderr, "expected DoctypeToken.String() to be %q, got %q\n", "Doctype", html.DoctypeToken.String())
		os.Exit(1)
	}

	// 2. Tokenize an HTML document starting with <!DOCTYPE html> and verify DoctypeToken is emitted
	input := "<!DOCTYPE html><html><head><title>Test</title></head><body></body></html>"
	z := html.NewTokenizer(strings.NewReader(input))

	tt := z.Next()
	if tt != html.DoctypeToken {
		fmt.Fprintf(os.Stderr, "expected first token type to be DoctypeToken (%v), got %v\n", html.DoctypeToken, tt)
		os.Exit(1)
	}

	tok := z.Token()
	if tok.Type != html.DoctypeToken {
		fmt.Fprintf(os.Stderr, "expected Token.Type to be DoctypeToken, got %v\n", tok.Type)
		os.Exit(1)
	}
	if tok.Data != "html" {
		fmt.Fprintf(os.Stderr, "expected doctype Token.Data to be %q, got %q\n", "html", tok.Data)
		os.Exit(1)
	}

	// 3. Verify non-doctype tokens do not match html.DoctypeToken
	tt2 := z.Next()
	if tt2 == html.DoctypeToken || tt2 != html.StartTagToken {
		fmt.Fprintf(os.Stderr, "expected second token to be StartTagToken (not DoctypeToken), got %v\n", tt2)
		os.Exit(1)
	}
}

Origin Seeder

anonymous