Sample
golang.org/x/net v0.0.0-20210525063256-abc453219eb5: html.EndTagToken
Verified sample for golang golang.org/x/net v0.0.0-20210525063256-abc453219eb5: html.EndTagToken. The contract ran on go 1.26 · linux debian/x64 · docker and…
sha256:a40ebe1315db8174789888d4aca71f186e3ac12ca2ec4ef1d2d65b07983392fa
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-19 |
Case
HOW- Goal
- verify golang.org/x/net/html.EndTagToken in pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5
- Symbols
-
- golang.org/x/net/html.EndTagToken
- Created
- 2026-10-19T19:11:42Z
Contract
- html.EndTagToken is a TokenType constant whose String() returns "EndTag"
- html.EndTagToken is distinct from StartTagToken, SelfClosingTagToken, TextToken, and CommentToken
- html.NewTokenizer emits html.EndTagToken when encountering closing tags
- html.Token with html.EndTagToken serializes to </tag> string representation
- Tokenizer.TagName returns tag name and no attributes for html.EndTagToken
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- sample.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 golang.org/x/net/html.EndTagToken in pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5
Demonstrate these symbols/APIs:
- golang.org/x/net/html.EndTagToken
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:66ffa40af2dcac2bbe4f9770e373a2328a8ddfb9191e8930d1e88ab3fc7b92d1","contract":["html.EndTagToken is a TokenType constant whose String() returns \"EndTag\"","html.EndTagToken is distinct from StartTagToken, SelfClosingTagToken, TextToken, and CommentToken","html.NewTokenizer emits html.EndTagToken when encountering closing tags","html.Token with html.EndTagToken serializes to \u003c/tag\u003e string representation","Tokenizer.TagName returns tag name and no attributes for html.EndTagToken"],"goal":"verify golang.org/x/net/html.EndTagToken in pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5"],"schemaVersion":1,"symbols":["golang.org/x/net/html.EndTagToken"]},"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-20210525063256-abc453219eb5"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5","symbols":["golang.org/x/net/html.EndTagToken"],"verifierAdapter":"golang@1"}
module sample
go 1.25.0
require golang.org/x/net v0.0.0-20210525063256-abc453219eb5
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
package sample
import (
"fmt"
"io"
"strings"
"golang.org/x/net/html"
)
// IsEndTag reports whether the provided TokenType equals html.EndTagToken.
func IsEndTag(tt html.TokenType) bool {
return tt == html.EndTagToken
}
// NewEndTagToken constructs an html.Token of type html.EndTagToken with the given tag name.
func NewEndTagToken(tagName string) html.Token {
return html.Token{
Type: html.EndTagToken,
Data: tagName,
}
}
// CollectEndTags tokenizes HTML from the reader and returns all closing tag names in order.
func CollectEndTags(r io.Reader) ([]string, error) {
z := html.NewTokenizer(r)
var tags []string
for {
tt := z.Next()
switch tt {
case html.ErrorToken:
err := z.Err()
if err == io.EOF {
return tags, nil
}
return nil, fmt.Errorf("tokenizer error: %w", err)
case html.EndTagToken:
name, _ := z.TagName()
tags = append(tags, string(name))
}
}
}
// CheckBalancedEndTags verifies that every StartTagToken has a matching EndTagToken in LIFO order.
func CheckBalancedEndTags(markup string) (bool, error) {
z := html.NewTokenizer(strings.NewReader(markup))
var stack []string
for {
tt := z.Next()
switch tt {
case html.ErrorToken:
err := z.Err()
if err == io.EOF {
return len(stack) == 0, nil
}
return false, fmt.Errorf("tokenizer error: %w", err)
case html.StartTagToken:
name, _ := z.TagName()
stack = append(stack, string(name))
case html.EndTagToken:
name, _ := z.TagName()
tag := string(name)
if len(stack) == 0 || stack[len(stack)-1] != tag {
return false, nil
}
stack = stack[:len(stack)-1]
}
}
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/net/html.EndTagToken in pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/net@v0.0.0-20210525063256-abc453219eb5"
],
"symbols": [
"golang.org/x/net/html.EndTagToken"
]
}
package main
import (
"fmt"
"os"
"reflect"
"strings"
"golang.org/x/net/html"
"sample"
)
func main() {
// Assertion 1: html.EndTagToken is a TokenType constant whose String() returns "EndTag"
var tt html.TokenType = html.EndTagToken
if tt.String() != "EndTag" {
fmt.Fprintf(os.Stderr, "FAIL: expected EndTagToken.String() == 'EndTag', got %q\n", tt.String())
os.Exit(1)
}
if !sample.IsEndTag(html.EndTagToken) {
fmt.Fprintf(os.Stderr, "FAIL: sample.IsEndTag returned false for html.EndTagToken\n")
os.Exit(1)
}
// Assertion 2: html.EndTagToken is distinct from StartTagToken, SelfClosingTagToken, TextToken, and CommentToken
otherTypes := []html.TokenType{
html.ErrorToken,
html.TextToken,
html.StartTagToken,
html.SelfClosingTagToken,
html.CommentToken,
html.DoctypeToken,
}
for _, ot := range otherTypes {
if html.EndTagToken == ot {
fmt.Fprintf(os.Stderr, "FAIL: EndTagToken unexpectedly equals %v\n", ot)
os.Exit(1)
}
if sample.IsEndTag(ot) {
fmt.Fprintf(os.Stderr, "FAIL: sample.IsEndTag returned true for %v\n", ot)
os.Exit(1)
}
}
// Assertion 3: html.NewTokenizer emits html.EndTagToken when encountering closing tags
snippet := `<article><h1>Title</h1><p>Body</p></article>`
endTags, err := sample.CollectEndTags(strings.NewReader(snippet))
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: CollectEndTags returned error: %v\n", err)
os.Exit(1)
}
expected := []string{"h1", "p", "article"}
if !reflect.DeepEqual(endTags, expected) {
fmt.Fprintf(os.Stderr, "FAIL: expected end tags %v, got %v\n", expected, endTags)
os.Exit(1)
}
// Assertion 4: html.Token with html.EndTagToken serializes to </tag> string representation
tok := sample.NewEndTagToken("section")
if tok.Type != html.EndTagToken {
fmt.Fprintf(os.Stderr, "FAIL: expected Type EndTagToken, got %v\n", tok.Type)
os.Exit(1)
}
if tok.String() != "</section>" {
fmt.Fprintf(os.Stderr, "FAIL: expected '</section>', got %q\n", tok.String())
os.Exit(1)
}
// Assertion 5: Tokenizer.TagName and Tokenizer.Token extract tag name and Token struct for html.EndTagToken
z := html.NewTokenizer(strings.NewReader("<footer></footer>"))
seenEnd := false
for {
kind := z.Next()
if kind == html.ErrorToken {
break
}
if kind == html.EndTagToken {
seenEnd = true
name, hasAttr := z.TagName()
if string(name) != "footer" {
fmt.Fprintf(os.Stderr, "FAIL: expected tag name 'footer', got %q\n", string(name))
os.Exit(1)
}
if hasAttr {
fmt.Fprintf(os.Stderr, "FAIL: expected hasAttr=false on EndTagToken\n")
os.Exit(1)
}
raw := string(z.Raw())
if raw != "</footer>" {
fmt.Fprintf(os.Stderr, "FAIL: expected raw '</footer>', got %q\n", raw)
os.Exit(1)
}
}
}
if !seenEnd {
fmt.Fprintf(os.Stderr, "FAIL: did not encounter EndTagToken\n")
os.Exit(1)
}
ok, err := sample.CheckBalancedEndTags("<div><span>text</span></div>")
if err != nil || !ok {
fmt.Fprintf(os.Stderr, "FAIL: CheckBalancedEndTags failed for balanced input: ok=%v, err=%v\n", ok, err)
os.Exit(1)
}
unbalanced, err := sample.CheckBalancedEndTags("<div><span>text</div></span>")
if err != nil || unbalanced {
fmt.Fprintf(os.Stderr, "FAIL: CheckBalancedEndTags failed for unbalanced input: unbalanced=%v, err=%v\n", unbalanced, err)
os.Exit(1)
}
}
Origin Seeder
anonymous