Beispiel
golang.org/x/net v0.41.0: html.ErrorNode
Verifiziertes Beispiel für golang golang.org/x/net v0.41.0: html.ErrorNode. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und bestand.
sha256:84c3dfe7501ca91e4e3becbbd4b1d4853bb298e34ae2305bac1193f67f62b40f
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
linux 24 · ubuntu · glibc 2.39 x64 go
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-15 |
Fall
HOW- Ziel
- verify golang.org/x/net/html.ErrorNode in pkg:golang/golang.org/x/net@v0.41.0
- Pakete
- Symbole
-
- golang.org/x/net/html.ErrorNode
- Erstellt
- 2026-10-15T03:01:00Z
Contract
- html.ErrorNode is the zero-value NodeType constant equal to uint32(0)
- zero-initialized html.Node defaults to Type == html.ErrorNode
- explicitly constructed html.Node with Type: html.ErrorNode preserves Type and Data
- html.ErrorNode is distinct from TextNode, DocumentNode, ElementNode, CommentNode, DoctypeNode, and RawNode
- html.Parse on well-formed HTML yields a node tree containing zero html.ErrorNode nodes
- appending an html.ErrorNode child into a tree makes it discoverable by Type == html.ErrorNode
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Quelltext
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.ErrorNode in pkg:golang/golang.org/x/net@v0.41.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/net@v0.41.0
Demonstrate these symbols/APIs:
- golang.org/x/net/html.ErrorNode
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:af5468585d37786007de2d03677e89e93be4d6f2d8a5c81515b030b6b2f8c5f7","contract":["html.ErrorNode is the zero-value NodeType constant equal to uint32(0)","zero-initialized html.Node defaults to Type == html.ErrorNode","explicitly constructed html.Node with Type: html.ErrorNode preserves Type and Data","html.ErrorNode is distinct from TextNode, DocumentNode, ElementNode, CommentNode, DoctypeNode, and RawNode","html.Parse on well-formed HTML yields a node tree containing zero html.ErrorNode nodes","appending an html.ErrorNode child into a tree makes it discoverable by Type == html.ErrorNode"],"goal":"verify golang.org/x/net/html.ErrorNode in pkg:golang/golang.org/x/net@v0.41.0","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.41.0"],"schemaVersion":1,"symbols":["golang.org/x/net/html.ErrorNode"]},"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.41.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.41.0","symbols":["golang.org/x/net/html.ErrorNode"],"verifierAdapter":"golang@1"}
module sample
go 1.24.0
require golang.org/x/net v0.41.0
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
package main
import (
"fmt"
"strings"
"golang.org/x/net/html"
)
func IsError(n *html.Node) bool {
return n != nil && n.Type == html.ErrorNode
}
func CollectErrorNodes(root *html.Node) []*html.Node {
var out []*html.Node
var visit func(*html.Node)
visit = func(n *html.Node) {
if n == nil {
return
}
if n.Type == html.ErrorNode {
out = append(out, n)
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
visit(c)
}
}
visit(root)
return out
}
func main() {
var zeroNode html.Node
fmt.Printf("Zero-value html.Node is ErrorNode: %v (type=%d)\n", IsError(&zeroNode), zeroNode.Type)
errNode := &html.Node{
Type: html.ErrorNode,
Data: "synthetic html error node",
}
fmt.Printf("Explicit ErrorNode: isError=%v data=%q\n", IsError(errNode), errNode.Data)
doc, err := html.Parse(strings.NewReader("<html><body><p>valid</p></body></html>"))
if err != nil {
panic(err)
}
fmt.Printf("ErrorNodes in valid parsed HTML: %d\n", len(CollectErrorNodes(doc)))
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/net/html.ErrorNode in pkg:golang/golang.org/x/net@v0.41.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/net@v0.41.0"
],
"symbols": [
"golang.org/x/net/html.ErrorNode"
]
}
package main
import (
"fmt"
"os"
"strings"
"golang.org/x/net/html"
)
func fail(msg string, args ...any) {
fmt.Fprintf(os.Stderr, "FAIL: "+msg+"\n", args...)
os.Exit(1)
}
func main() {
// 1. html.ErrorNode is the zero-value NodeType constant (uint32(0))
if html.ErrorNode != html.NodeType(0) || uint32(html.ErrorNode) != 0 {
fail("expected html.ErrorNode to equal 0, got %v", html.ErrorNode)
}
// 2. Zero-initialized html.Node defaults to Type == html.ErrorNode
var zero html.Node
if zero.Type != html.ErrorNode {
fail("expected zero-value html.Node.Type to be html.ErrorNode, got %v", zero.Type)
}
// 3. Explicitly constructed html.Node with Type: html.ErrorNode preserves Type and Data
custom := &html.Node{
Type: html.ErrorNode,
Data: "unexpected EOF in token stream",
}
if custom.Type != html.ErrorNode {
fail("expected custom.Type to be html.ErrorNode, got %v", custom.Type)
}
if custom.Data != "unexpected EOF in token stream" {
fail("expected custom.Data to be preserved, got %q", custom.Data)
}
// 4. html.ErrorNode is distinct from all other standard html.NodeType constants
otherTypes := []html.NodeType{
html.TextNode,
html.DocumentNode,
html.ElementNode,
html.CommentNode,
html.DoctypeNode,
html.RawNode,
}
for _, nt := range otherTypes {
if nt == html.ErrorNode {
fail("expected html.ErrorNode to be distinct from %v", nt)
}
}
// 5. html.Parse on well-formed HTML yields a node tree containing zero html.ErrorNode nodes
doc, err := html.Parse(strings.NewReader("<!DOCTYPE html><html><head><title>OK</title></head><body><div>Hello</div></body></html>"))
if err != nil {
fail("html.Parse failed: %v", err)
}
var count int
var walk func(*html.Node)
walk = func(n *html.Node) {
if n.Type == html.ErrorNode {
count++
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
walk(c)
}
}
walk(doc)
if count != 0 {
fail("expected 0 ErrorNode instances in parsed document, got %d", count)
}
// 6. Appending an html.ErrorNode child into a tree makes it discoverable by Type == html.ErrorNode
doc.AppendChild(custom)
count = 0
walk(doc)
if count != 1 {
fail("expected 1 ErrorNode instance after appending custom ErrorNode, got %d", count)
}
fmt.Println("PASS")
}
Ursprungs-Seeder
anonym