Beispiel
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2
Verifiziertes Beispiel für golang github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und…
sha256:180eeaeb624f1e29145d325ceb4c6df71a096047db506f1007828f4949d0223c
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-11-03 |
Fall
HOW- Ziel
- verify pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2
- Erstellt
- 2026-10-28T14:01:51Z
Contract
- profile.Profile.CheckValid returns nil when SampleType, Sample, Location, and Function references are consistent
- profile.Profile.WriteUncompressed serializes a valid Profile into wire format that profile.ParseData round-trips without data loss
- profile.Profile.Copy produces an independent deep copy and Scale multiplies Sample.Value entries without mutating the source Profile
- profile.Merge combines compatible Profile instances and sums Sample.Value slices for matching sample locations
Dateien
- PROMPT.md
- csx.json
- go.mod
- go.sum
- 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 pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2
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:1e4b284a12944ea924eef0293640281b73f768ecbad4f5865a74cb151e216ac1","contract":["profile.Profile.CheckValid returns nil when SampleType, Sample, Location, and Function references are consistent","profile.Profile.WriteUncompressed serializes a valid Profile into wire format that profile.ParseData round-trips without data loss","profile.Profile.Copy produces an independent deep copy and Scale multiplies Sample.Value entries without mutating the source Profile","profile.Merge combines compatible Profile instances and sums Sample.Value slices for matching sample locations"],"goal":"verify pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2","kind":"HOW","packages":["pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2"],"schemaVersion":1},"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/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2"],"schemaVersion":1,"subject":"pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2","verifierAdapter":"golang@1"}
module sample
go 1.21
require github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2 h1:LR89qFljJ48s990kEKGsk213yIJDPI4205OKOzbURK8=
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/google/pprof@v0.0.0-20201218002935-b9804c9f04c2"
]
}
package main
import (
"bytes"
"fmt"
"os"
"github.com/google/pprof/profile"
)
func main() {
fn := &profile.Function{
ID: 1,
Name: "main.compute",
SystemName: "main.compute",
Filename: "main.go",
StartLine: 10,
}
loc := &profile.Location{
ID: 1,
Address: 0x1000,
Line: []profile.Line{
{Function: fn, Line: 15},
},
}
prof := &profile.Profile{
SampleType: []*profile.ValueType{
{Type: "samples", Unit: "count"},
{Type: "cpu", Unit: "nanoseconds"},
},
DefaultSampleType: "cpu",
Sample: []*profile.Sample{
{
Location: []*profile.Location{loc},
Value: []int64{10, 5000000},
Label: map[string][]string{
"tag": {"worker"},
},
},
},
Location: []*profile.Location{loc},
Function: []*profile.Function{fn},
DurationNanos: 10000000,
PeriodType: &profile.ValueType{Type: "cpu", Unit: "nanoseconds"},
Period: 100000,
}
if err := prof.CheckValid(); err != nil {
fmt.Fprintf(os.Stderr, "initial CheckValid failed: %v\n", err)
os.Exit(1)
}
var buf bytes.Buffer
if err := prof.WriteUncompressed(&buf); err != nil {
fmt.Fprintf(os.Stderr, "WriteUncompressed failed: %v\n", err)
os.Exit(1)
}
parsed, err := profile.ParseData(buf.Bytes())
if err != nil {
fmt.Fprintf(os.Stderr, "ParseData failed: %v\n", err)
os.Exit(1)
}
if err := parsed.CheckValid(); err != nil {
fmt.Fprintf(os.Stderr, "parsed CheckValid failed: %v\n", err)
os.Exit(1)
}
if len(parsed.Sample) != 1 || len(parsed.Sample[0].Value) != 2 || parsed.Sample[0].Value[1] != 5000000 {
fmt.Fprintf(os.Stderr, "unexpected parsed sample values: %+v\n", parsed.Sample)
os.Exit(1)
}
if parsed.Sample[0].Location[0].Line[0].Function.Name != "main.compute" {
fmt.Fprintf(os.Stderr, "unexpected function name: %s\n", parsed.Sample[0].Location[0].Line[0].Function.Name)
os.Exit(1)
}
copied := parsed.Copy()
copied.Scale(2.0)
if copied.Sample[0].Value[0] != 20 || copied.Sample[0].Value[1] != 10000000 {
fmt.Fprintf(os.Stderr, "unexpected scaled values: %v\n", copied.Sample[0].Value)
os.Exit(1)
}
if parsed.Sample[0].Value[0] != 10 {
fmt.Fprintf(os.Stderr, "original mutated on scaled copy: %v\n", parsed.Sample[0].Value)
os.Exit(1)
}
merged, err := profile.Merge([]*profile.Profile{parsed, copied})
if err != nil {
fmt.Fprintf(os.Stderr, "Merge failed: %v\n", err)
os.Exit(1)
}
if err := merged.CheckValid(); err != nil {
fmt.Fprintf(os.Stderr, "merged CheckValid failed: %v\n", err)
os.Exit(1)
}
if len(merged.Sample) != 1 || merged.Sample[0].Value[0] != 30 || merged.Sample[0].Value[1] != 15000000 {
fmt.Fprintf(os.Stderr, "unexpected merged sample values: %+v\n", merged.Sample[0].Value)
os.Exit(1)
}
}
Ursprungs-Seeder
anonym