サンプル
golang.org/x/net v0.61.0: atom.H6
検証済みサンプル — golang golang.org/x/net v0.61.0: atom.H6. go 1.26 · linux debian/x64 · docker で contract を実行し、成功しました: atom.H6 constant represents the HTML h6…
sha256:757cf10aa14f29d935e883c0d0271f02d31c0fda6f05d4220b55e45308c33488
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 go
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-12 |
ケース
HOW- ゴール
- verify golang.org/x/net/html/atom.H6 in pkg:golang/golang.org/x/net@v0.61.0
- パッケージ
- シンボル
-
- golang.org/x/net/html/atom.H6
- 作成日
- 2026-10-12T05:57:31Z
コントラクト
- atom.H6 constant represents the HTML h6 element tag with string value h6
- atom.Lookup resolves byte slice []byte("h6") to atom.H6
- html.Tokenizer recognizes <h6> start and end tags with atom.Lookup matching atom.H6
- html.Parse constructs an AST ElementNode with DataAtom equal to atom.H6 for heading elements
- html.Render formats an ElementNode with DataAtom atom.H6 into valid HTML <h6> element tags
ファイル
- PROMPT.md
- csx.json
- go.mod
- go.sum
- sample.go
- spec.json
- test/contract.go
ソース
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/atom.H6 in pkg:golang/golang.org/x/net@v0.61.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/net@v0.61.0
Demonstrate these symbols/APIs:
- golang.org/x/net/html/atom.H6
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:ca2c5ad62277ea5e1fcb4dba35ac5bbc49e57d0f51d31b1a97d558e172c150aa","contract":["atom.H6 constant represents the HTML h6 element tag with string value h6","atom.Lookup resolves byte slice []byte(\"h6\") to atom.H6","html.Tokenizer recognizes \u003ch6\u003e start and end tags with atom.Lookup matching atom.H6","html.Parse constructs an AST ElementNode with DataAtom equal to atom.H6 for heading elements","html.Render formats an ElementNode with DataAtom atom.H6 into valid HTML \u003ch6\u003e element tags"],"goal":"verify golang.org/x/net/html/atom.H6 in pkg:golang/golang.org/x/net@v0.61.0","kind":"HOW","packages":["pkg:golang/golang.org/x/net@v0.61.0"],"schemaVersion":1,"symbols":["golang.org/x/net/html/atom.H6"]},"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.61.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/net@v0.61.0","symbols":["golang.org/x/net/html/atom.H6"],"verifierAdapter":"golang@1"}
module sample
go 1.26.0
require golang.org/x/net v0.61.0
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
package sample
import (
"bytes"
"fmt"
"io"
"strings"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
)
// IsH6Atom returns true if the given atom equals atom.H6.
func IsH6Atom(a atom.Atom) bool {
return a == atom.H6
}
// LookupH6 checks if the byte slice maps to atom.H6.
func LookupH6(b []byte) (atom.Atom, bool) {
a := atom.Lookup(b)
return a, a == atom.H6
}
// FindH6Nodes recursively searches an HTML node tree for all element nodes with DataAtom == atom.H6.
func FindH6Nodes(root *html.Node) []*html.Node {
var results []*html.Node
var walk func(*html.Node)
walk = func(n *html.Node) {
if n.Type == html.ElementNode && n.DataAtom == atom.H6 {
results = append(results, n)
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
walk(c)
}
}
walk(root)
return results
}
// RenderH6 creates an HTML element node for atom.H6 and renders it to a string.
func RenderH6(text string) (string, error) {
h6Node := &html.Node{
Type: html.ElementNode,
DataAtom: atom.H6,
Data: atom.H6.String(),
}
if text != "" {
h6Node.AppendChild(&html.Node{
Type: html.TextNode,
Data: text,
})
}
var buf bytes.Buffer
if err := html.Render(&buf, h6Node); err != nil {
return "", fmt.Errorf("render h6: %w", err)
}
return buf.String(), nil
}
// ExtractH6Headings parses HTML content and extracts the text content of all <h6> headings.
func ExtractH6Headings(r io.Reader) ([]string, error) {
doc, err := html.Parse(r)
if err != nil {
return nil, fmt.Errorf("parse html: %w", err)
}
nodes := FindH6Nodes(doc)
var headings []string
for _, n := range nodes {
var text strings.Builder
for c := n.FirstChild; c != nil; c = c.NextSibling {
if c.Type == html.TextNode {
text.WriteString(c.Data)
}
}
headings = append(headings, text.String())
}
return headings, nil
}
{
"schemaVersion": 1,
"goal": "verify golang.org/x/net/html/atom.H6 in pkg:golang/golang.org/x/net@v0.61.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/net@v0.61.0"
],
"symbols": [
"golang.org/x/net/html/atom.H6"
]
}
package main
import (
"fmt"
"os"
"strings"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
"sample"
)
func main() {
// Assertion 1: atom.H6 constant represents the HTML h6 element tag with string value h6
if atom.H6 == 0 {
fmt.Fprintf(os.Stderr, "FAIL: atom.H6 must not be zero\n")
os.Exit(1)
}
if atom.H6.String() != "h6" {
fmt.Fprintf(os.Stderr, "FAIL: expected atom.H6.String() == 'h6', got %q\n", atom.H6.String())
os.Exit(1)
}
if !sample.IsH6Atom(atom.H6) {
fmt.Fprintf(os.Stderr, "FAIL: sample.IsH6Atom failed for atom.H6\n")
os.Exit(1)
}
if sample.IsH6Atom(atom.H1) {
fmt.Fprintf(os.Stderr, "FAIL: sample.IsH6Atom returned true for atom.H1\n")
os.Exit(1)
}
// Assertion 2: atom.Lookup resolves byte slice []byte("h6") to atom.H6
lookedUp, isH6 := sample.LookupH6([]byte("h6"))
if !isH6 || lookedUp != atom.H6 {
fmt.Fprintf(os.Stderr, "FAIL: expected LookupH6('h6') to return atom.H6, got %v\n", lookedUp)
os.Exit(1)
}
if atom.String([]byte("h6")) != "h6" {
fmt.Fprintf(os.Stderr, "FAIL: expected atom.String('h6') == 'h6', got %q\n", atom.String([]byte("h6")))
os.Exit(1)
}
_, notH6 := sample.LookupH6([]byte("div"))
if notH6 {
fmt.Fprintf(os.Stderr, "FAIL: LookupH6('div') unexpectedly returned true\n")
os.Exit(1)
}
// Assertion 3: html.Tokenizer recognizes <h6> start and end tags with atom.Lookup matching atom.H6
snippet := "<article><h6>Subheading</h6><p>Content</p></article>"
tokenizer := html.NewTokenizer(strings.NewReader(snippet))
foundStart := false
foundEnd := false
for {
tt := tokenizer.Next()
if tt == html.ErrorToken {
break
}
tagName, _ := tokenizer.TagName()
if tt == html.StartTagToken && atom.Lookup(tagName) == atom.H6 {
foundStart = true
}
if tt == html.EndTagToken && atom.Lookup(tagName) == atom.H6 {
foundEnd = true
}
}
if !foundStart {
fmt.Fprintf(os.Stderr, "FAIL: html.Tokenizer failed to identify <h6> StartTagToken with atom.H6\n")
os.Exit(1)
}
if !foundEnd {
fmt.Fprintf(os.Stderr, "FAIL: html.Tokenizer failed to identify </h6> EndTagToken with atom.H6\n")
os.Exit(1)
}
// Assertion 4: html.Parse constructs an AST ElementNode with DataAtom equal to atom.H6 for heading elements
htmlDoc := `<html><body><h6>Header Level 6</h6><p>Body</p><h6>Another Heading</h6></body></html>`
headings, err := sample.ExtractH6Headings(strings.NewReader(htmlDoc))
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: ExtractH6Headings returned error: %v\n", err)
os.Exit(1)
}
if len(headings) != 2 {
fmt.Fprintf(os.Stderr, "FAIL: expected 2 headings, got %d\n", len(headings))
os.Exit(1)
}
if headings[0] != "Header Level 6" || headings[1] != "Another Heading" {
fmt.Fprintf(os.Stderr, "FAIL: unexpected headings extracted: %v\n", headings)
os.Exit(1)
}
// Assertion 5: html.Render formats an ElementNode with DataAtom atom.H6 into valid HTML <h6> element tags
rendered, err := sample.RenderH6("Nested Heading Text")
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: RenderH6 returned error: %v\n", err)
os.Exit(1)
}
expectedRender := "<h6>Nested Heading Text</h6>"
if rendered != expectedRender {
fmt.Fprintf(os.Stderr, "FAIL: expected rendered %q, got %q\n", expectedRender, rendered)
os.Exit(1)
}
emptyRender, err := sample.RenderH6("")
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: RenderH6 empty returned error: %v\n", err)
os.Exit(1)
}
if emptyRender != "<h6></h6>" {
fmt.Fprintf(os.Stderr, "FAIL: expected empty render '<h6></h6>', got %q\n", emptyRender)
os.Exit(1)
}
fmt.Println("PASS: all golang.org/x/net/html/atom.H6 contract assertions passed")
}
オリジンシーダー
匿名