Beispiel
github.com/klauspost/compress v1.19.1: zlib.NoCompression
Verifiziertes Beispiel für golang github.com/klauspost/compress v1.19.1: zlib.NoCompression. Der Vertrag lief auf go 1.26 · linux debian/x64 · docker und…
sha256:90161b7fdb89743bd6756de3b88975cc6ae04ffe20e1c2c2eecf8b3ad956a6c3
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 github.com/klauspost/compress/zlib.NoCompression in pkg:golang/github.com/klauspost/compress@v1.19.1
- Symbole
-
- github.com/klauspost/compress/zlib.NoCompression
- Erstellt
- 2026-10-11T08:39:18Z
Contract
- zlib.NoCompression constant equals 0
- zlib.NewWriterLevel with zlib.NoCompression stores payload and roundtrips to original content via zlib.NewReader
- zlib.NewWriterLevel with zlib.NoCompression writes empty input and emits a valid zlib stream
- zlib.NewWriterLevel with zlib.NoCompression Flush pushes buffered data to underlying writer
- zlib.NewWriterLevelDict with zlib.NoCompression initializes a writer with custom dictionary and roundtrips correctly
- zlib.NewWriterLevel with zlib.NoCompression Reset resets the writer destination and allows reuse
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 github.com/klauspost/compress/zlib.NoCompression in pkg:golang/github.com/klauspost/compress@v1.19.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/klauspost/compress@v1.19.1
Demonstrate these symbols/APIs:
- github.com/klauspost/compress/zlib.NoCompression
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:6d2e99e3e5a406e64ed712acc30d05d6ae9b146c425530c7867ee5725a5f7bd0","contract":["zlib.NoCompression constant equals 0","zlib.NewWriterLevel with zlib.NoCompression stores payload and roundtrips to original content via zlib.NewReader","zlib.NewWriterLevel with zlib.NoCompression writes empty input and emits a valid zlib stream","zlib.NewWriterLevel with zlib.NoCompression Flush pushes buffered data to underlying writer","zlib.NewWriterLevelDict with zlib.NoCompression initializes a writer with custom dictionary and roundtrips correctly","zlib.NewWriterLevel with zlib.NoCompression Reset resets the writer destination and allows reuse"],"goal":"verify github.com/klauspost/compress/zlib.NoCompression in pkg:golang/github.com/klauspost/compress@v1.19.1","kind":"HOW","packages":["pkg:golang/github.com/klauspost/compress@v1.19.1"],"schemaVersion":1,"symbols":["github.com/klauspost/compress/zlib.NoCompression"]},"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/klauspost/compress@v1.19.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/klauspost/compress@v1.19.1","symbols":["github.com/klauspost/compress/zlib.NoCompression"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require github.com/klauspost/compress v1.19.1
github.com/klauspost/compress v1.19.1 h1:VsB4HPswih7mmZ8WleSFQ75c/Ui1M4trX5oAsJnhSlk=
github.com/klauspost/compress v1.19.1/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
package main
import (
"bytes"
"fmt"
"io"
"log"
"github.com/klauspost/compress/zlib"
)
func main() {
originalData := []byte("Demonstrating zlib compression using NoCompression level.")
var compressedBuf bytes.Buffer
writer, err := zlib.NewWriterLevel(&compressedBuf, zlib.NoCompression)
if err != nil {
log.Fatalf("failed to create zlib writer: %v", err)
}
if _, err := writer.Write(originalData); err != nil {
log.Fatalf("failed to write data: %v", err)
}
if err := writer.Close(); err != nil {
log.Fatalf("failed to close zlib writer: %v", err)
}
compressedLen := compressedBuf.Len()
reader, err := zlib.NewReader(&compressedBuf)
if err != nil {
log.Fatalf("failed to create zlib reader: %v", err)
}
defer reader.Close()
decompressed, err := io.ReadAll(reader)
if err != nil {
log.Fatalf("failed to read decompressed data: %v", err)
}
fmt.Printf("NoCompression level: %d\n", zlib.NoCompression)
fmt.Printf("Original size: %d, Compressed size: %d\n", len(originalData), compressedLen)
fmt.Printf("Decompressed data matches: %t\n", bytes.Equal(originalData, decompressed))
}
{
"schemaVersion": 1,
"goal": "verify github.com/klauspost/compress/zlib.NoCompression in pkg:golang/github.com/klauspost/compress@v1.19.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/klauspost/compress@v1.19.1"
],
"symbols": [
"github.com/klauspost/compress/zlib.NoCompression"
]
}
package main
import (
"bytes"
"compress/flate"
"fmt"
"io"
"os"
"github.com/klauspost/compress/zlib"
)
func main() {
// Assertion 1: zlib.NoCompression constant equals 0
if zlib.NoCompression != 0 || zlib.NoCompression != flate.NoCompression {
fmt.Fprintf(os.Stderr, "assertion 1 failed: expected NoCompression to equal 0, got %d\n", zlib.NoCompression)
os.Exit(1)
}
// Assertion 2: zlib.NewWriterLevel with zlib.NoCompression stores payload and roundtrips to original content via zlib.NewReader
{
payload := bytes.Repeat([]byte("Contract assertion testing NoCompression payload compression roundtrip. "), 20)
var buf bytes.Buffer
zw, err := zlib.NewWriterLevel(&buf, zlib.NoCompression)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: NewWriterLevel error: %v\n", err)
os.Exit(1)
}
if _, err := zw.Write(payload); err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: Write error: %v\n", err)
os.Exit(1)
}
if err := zw.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: Close error: %v\n", err)
os.Exit(1)
}
zr, err := zlib.NewReader(&buf)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: NewReader error: %v\n", err)
os.Exit(1)
}
decomp, err := io.ReadAll(zr)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: ReadAll error: %v\n", err)
os.Exit(1)
}
if err := zr.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 2 failed: zr.Close error: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(payload, decomp) {
fmt.Fprintf(os.Stderr, "assertion 2 failed: decompressed payload mismatch\n")
os.Exit(1)
}
}
// Assertion 3: zlib.NewWriterLevel with zlib.NoCompression writes empty input and emits a valid zlib stream
{
var buf bytes.Buffer
zw, err := zlib.NewWriterLevel(&buf, zlib.NoCompression)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: NewWriterLevel error: %v\n", err)
os.Exit(1)
}
if err := zw.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: Close error: %v\n", err)
os.Exit(1)
}
if buf.Len() == 0 {
fmt.Fprintf(os.Stderr, "assertion 3 failed: expected non-empty zlib header/footer, got 0 bytes\n")
os.Exit(1)
}
zr, err := zlib.NewReader(&buf)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: NewReader error: %v\n", err)
os.Exit(1)
}
decomp, err := io.ReadAll(zr)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: ReadAll error: %v\n", err)
os.Exit(1)
}
if err := zr.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: zr.Close error: %v\n", err)
os.Exit(1)
}
if len(decomp) != 0 {
fmt.Fprintf(os.Stderr, "assertion 3 failed: expected 0 bytes decompressed, got %d\n", len(decomp))
os.Exit(1)
}
}
// Assertion 4: zlib.NewWriterLevel with zlib.NoCompression Flush pushes buffered data to underlying writer
{
var buf bytes.Buffer
zw, err := zlib.NewWriterLevel(&buf, zlib.NoCompression)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: NewWriterLevel error: %v\n", err)
os.Exit(1)
}
msg := []byte("flush verification for zlib writer using no compression level")
if _, err := zw.Write(msg); err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: Write error: %v\n", err)
os.Exit(1)
}
if err := zw.Flush(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: Flush error: %v\n", err)
os.Exit(1)
}
if buf.Len() == 0 {
fmt.Fprintf(os.Stderr, "assertion 4 failed: expected flushed bytes in buffer, got 0\n")
os.Exit(1)
}
if err := zw.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: Close error: %v\n", err)
os.Exit(1)
}
zr, err := zlib.NewReader(&buf)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: NewReader error: %v\n", err)
os.Exit(1)
}
decomp, err := io.ReadAll(zr)
if err != nil || !bytes.Equal(decomp, msg) {
fmt.Fprintf(os.Stderr, "assertion 4 failed: decomp mismatch after Flush\n")
os.Exit(1)
}
_ = zr.Close()
}
// Assertion 5: zlib.NewWriterLevelDict with zlib.NoCompression initializes a writer with custom dictionary and roundtrips correctly
{
dict := []byte("predefined zlib dictionary terms keywords protocol schemas")
payload := []byte("predefined zlib dictionary terms repeating words protocol schemas")
var buf bytes.Buffer
zwDict, err := zlib.NewWriterLevelDict(&buf, zlib.NoCompression, dict)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: NewWriterLevelDict error: %v\n", err)
os.Exit(1)
}
if _, err := zwDict.Write(payload); err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Write error: %v\n", err)
os.Exit(1)
}
if err := zwDict.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Close error: %v\n", err)
os.Exit(1)
}
zrDict, err := zlib.NewReaderDict(&buf, dict)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: NewReaderDict error: %v\n", err)
os.Exit(1)
}
decomp, err := io.ReadAll(zrDict)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: ReadAll error: %v\n", err)
os.Exit(1)
}
if err := zrDict.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 5 failed: zrDict.Close error: %v\n", err)
os.Exit(1)
}
if !bytes.Equal(payload, decomp) {
fmt.Fprintf(os.Stderr, "assertion 5 failed: dictionary decompression mismatch\n")
os.Exit(1)
}
}
// Assertion 6: zlib.NewWriterLevel with zlib.NoCompression Reset resets the writer destination and allows reuse
{
var buf1, buf2 bytes.Buffer
zw, err := zlib.NewWriterLevel(&buf1, zlib.NoCompression)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: NewWriterLevel error: %v\n", err)
os.Exit(1)
}
msg1 := []byte("first stream content before reset")
if _, err := zw.Write(msg1); err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: msg1 Write error: %v\n", err)
os.Exit(1)
}
if err := zw.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: msg1 Close error: %v\n", err)
os.Exit(1)
}
zw.Reset(&buf2)
msg2 := []byte("second stream content after reset")
if _, err := zw.Write(msg2); err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: msg2 Write error: %v\n", err)
os.Exit(1)
}
if err := zw.Close(); err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: msg2 Close error: %v\n", err)
os.Exit(1)
}
zr1, err := zlib.NewReader(&buf1)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: zr1 init error: %v\n", err)
os.Exit(1)
}
out1, err := io.ReadAll(zr1)
if err != nil || !bytes.Equal(out1, msg1) {
fmt.Fprintf(os.Stderr, "assertion 6 failed: out1 mismatch\n")
os.Exit(1)
}
_ = zr1.Close()
zr2, err := zlib.NewReader(&buf2)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 6 failed: zr2 init error: %v\n", err)
os.Exit(1)
}
out2, err := io.ReadAll(zr2)
if err != nil || !bytes.Equal(out2, msg2) {
fmt.Fprintf(os.Stderr, "assertion 6 failed: out2 mismatch\n")
os.Exit(1)
}
_ = zr2.Close()
}
fmt.Println("All contract assertions passed.")
}
Ursprungs-Seeder
anonym