CodeSampleX

Beispiel

golang.org/x/net v0.61.0: atom.Head

Verifiziertes Beispiel für golang golang.org/x/net v0.61.0: atom.Head. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und bestand.

sha256:caa2b1bd07d8f5521f009a6dc2ef01a426967de2346550c4dcdebf9fdfb52df5

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

Fall

HOW
Ziel
verify golang.org/x/net/html/atom.Head in pkg:golang/golang.org/x/net@v0.61.0
Pakete
Symbole
  • golang.org/x/net/html/atom.Head
Erstellt
2026-10-11T16:57:39Z

Contract

  1. atom.Head represents the HTML head tag atom with non-zero integer code and 'head' string representation
  2. atom.Lookup maps lowercase byte slice 'head' to atom.Head and distinguishes other tags or non-atom identifiers

Dateien

  • PROMPT.md
  • atom_head.go
  • csx.json
  • go.mod
  • go.sum
  • spec.json
  • test/contract.go

Quellartefakt herunterladen (tar.gz)

Quelltext

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/atom.Head 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.Head

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.
atom_head.go
package atomheadsample

import (
	"golang.org/x/net/html/atom"
)

// IsHeadAtom checks whether the provided atom corresponds to the HTML 'head' element tag atom.
func IsHeadAtom(a atom.Atom) bool {
	return a == atom.Head
}

// HeadAtomString returns the string representation of atom.Head.
func HeadAtomString() string {
	return atom.Head.String()
}

// LookupHeadAtom looks up an atom by byte slice and checks if it matches atom.Head.
func LookupHeadAtom(b []byte) (atom.Atom, bool) {
	a := atom.Lookup(b)
	return a, a == atom.Head
}
csx.json
{"case":{"caseId":"case:sha256:42782c56fae35ac9f5209d5da7a69024034dcde3fdaf1329a19fdcf3c0b290d8","contract":["atom.Head represents the HTML head tag atom with non-zero integer code and 'head' string representation","atom.Lookup maps lowercase byte slice 'head' to atom.Head and distinguishes other tags or non-atom identifiers"],"goal":"verify golang.org/x/net/html/atom.Head 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.Head"]},"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.Head"],"verifierAdapter":"golang@1"}
go.mod
module example.com/atomheadsample

go 1.26.0

require golang.org/x/net v0.61.0
go.sum
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=
spec.json
{
  "schemaVersion": 1,
  "goal": "verify golang.org/x/net/html/atom.Head 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.Head"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	atomheadsample "example.com/atomheadsample"
	"golang.org/x/net/html/atom"
)

func main() {
	// Assertion 1: atom.Head is non-zero and its String() returns "head"
	if atom.Head == 0 {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.Head to be non-zero\n")
		os.Exit(1)
	}
	if atom.Head.String() != "head" {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.Head.String() to be 'head', got %q\n", atom.Head.String())
		os.Exit(1)
	}

	// Assertion 2: atom.Lookup of byte slice "head" resolves to atom.Head
	lookupHead := atom.Lookup([]byte("head"))
	if lookupHead != atom.Head {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.Lookup([]byte(\"head\")) to be atom.Head, got %v\n", lookupHead)
		os.Exit(1)
	}
	if lookupHead.String() != "head" {
		fmt.Fprintf(os.Stderr, "FAIL: expected lookupHead.String() to be 'head', got %q\n", lookupHead.String())
		os.Exit(1)
	}

	// Assertion 3: atom.Lookup is case-sensitive and non-matching tags return 0 or distinct atom
	lookupUpperHead := atom.Lookup([]byte("HEAD"))
	if lookupUpperHead != 0 {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.Lookup([]byte(\"HEAD\")) to be 0, got %v\n", lookupUpperHead)
		os.Exit(1)
	}
	lookupBody := atom.Lookup([]byte("body"))
	if lookupBody == atom.Head || lookupBody == 0 {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.Lookup([]byte(\"body\")) to differ from atom.Head and 0, got %v\n", lookupBody)
		os.Exit(1)
	}
	if atom.Lookup([]byte("headmaster")) != 0 {
		fmt.Fprintf(os.Stderr, "FAIL: expected non-atom tag 'headmaster' to yield 0\n")
		os.Exit(1)
	}

	// Assertion 4: atom.String helper matches atom.Head.String()
	str := atom.String([]byte("head"))
	if str != "head" {
		fmt.Fprintf(os.Stderr, "FAIL: expected atom.String([]byte(\"head\")) to be 'head', got %q\n", str)
		os.Exit(1)
	}

	// Assertion 5: Helper functions verify atom.Head identification and lookup
	if !atomheadsample.IsHeadAtom(atom.Head) {
		fmt.Fprintf(os.Stderr, "FAIL: IsHeadAtom(atom.Head) returned false\n")
		os.Exit(1)
	}
	if atomheadsample.IsHeadAtom(atom.Body) {
		fmt.Fprintf(os.Stderr, "FAIL: IsHeadAtom(atom.Body) returned true\n")
		os.Exit(1)
	}
	if atomheadsample.HeadAtomString() != "head" {
		fmt.Fprintf(os.Stderr, "FAIL: expected HeadAtomString() to be 'head', got %q\n", atomheadsample.HeadAtomString())
		os.Exit(1)
	}
	matchedAtom, isHead := atomheadsample.LookupHeadAtom([]byte("head"))
	if matchedAtom != atom.Head || !isHead {
		fmt.Fprintf(os.Stderr, "FAIL: LookupHeadAtom(\"head\") expected (atom.Head, true), got (%v, %v)\n", matchedAtom, isHead)
		os.Exit(1)
	}
	bodyAtom, isHead2 := atomheadsample.LookupHeadAtom([]byte("body"))
	if bodyAtom != atom.Body || isHead2 {
		fmt.Fprintf(os.Stderr, "FAIL: LookupHeadAtom(\"body\") expected (atom.Body, false), got (%v, %v)\n", bodyAtom, isHead2)
		os.Exit(1)
	}

	fmt.Println("PASS: golang.org/x/net/html/atom.Head contract passed")
}

Ursprungs-Seeder

anonym