Sample
github.com/matttproud/golang_protobuf_extensions v1.0.1: pbutil.ReadDelimited, pbutil.WriteDelimited
Verified sample for golang github.com/matttproud/golang_protobuf_extensions v1.0.1: pbutil.ReadDelimited, pbutil.WriteDelimited. The contract ran on go 1.26…
sha256:e7cdb1c9294a3bd88aa329da4f9dfa2c58c94155a38597ca1e7f5a0d3ee52dd7
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-28 |
Case
HOW- Goal
- verify pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1
- Symbols
-
- pbutil.ReadDelimited
- pbutil.WriteDelimited
- Created
- 2026-08-28T00:52:51Z
Contract
- pbutil.WriteDelimited encodes and writes length-delimited protobuf message to io.Writer.
- pbutil.ReadDelimited reads and decodes length-delimited protobuf message from io.Reader.
- pbutil.ReadDelimited returns io.EOF when reader has no more data.
- pbutil.ReadDelimited returns error when reader contains truncated data.
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract_test.go
Source
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/matttproud/golang_protobuf_extensions@v1.0.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1
Demonstrate these symbols/APIs:
- pbutil.ReadDelimited
- pbutil.WriteDelimited
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:b7267bca5e38ddff7821adbdd97162ee5a32918a17f93478be0759df19eff43a","contract":["pbutil.WriteDelimited encodes and writes length-delimited protobuf message to io.Writer.","pbutil.ReadDelimited reads and decodes length-delimited protobuf message from io.Reader.","pbutil.ReadDelimited returns io.EOF when reader has no more data.","pbutil.ReadDelimited returns error when reader contains truncated data."],"goal":"verify pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1","kind":"HOW","packages":["pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1"],"schemaVersion":1,"symbols":["pbutil.ReadDelimited","pbutil.WriteDelimited"]},"contractCommand":["go","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/matttproud/golang_protobuf_extensions@v1.0.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1","symbols":["pbutil.ReadDelimited","pbutil.WriteDelimited"],"verifierAdapter":"golang@1"}
module example.com/protobuf-delimited
go 1.26.6
require (
github.com/golang/protobuf v1.5.4
github.com/matttproud/golang_protobuf_extensions v1.0.1
)
require google.golang.org/protobuf v1.33.0 // indirect
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
package main
import (
"bytes"
"fmt"
"io"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/matttproud/golang_protobuf_extensions/pbutil"
)
func main() {
var buf bytes.Buffer
// Write delimited protobuf messages
msg1 := &wrappers.StringValue{Value: "first payload"}
msg2 := &wrappers.StringValue{Value: "second payload"}
n1, err := pbutil.WriteDelimited(&buf, msg1)
if err != nil {
panic(err)
}
fmt.Printf("Wrote message 1 (%d bytes)\n", n1)
n2, err := pbutil.WriteDelimited(&buf, msg2)
if err != nil {
panic(err)
}
fmt.Printf("Wrote message 2 (%d bytes)\n", n2)
// Read delimited protobuf messages back
var out1 wrappers.StringValue
r1, err := pbutil.ReadDelimited(&buf, &out1)
if err != nil {
panic(err)
}
fmt.Printf("Read message 1 (%d bytes): %s\n", r1, out1.GetValue())
var out2 wrappers.StringValue
r2, err := pbutil.ReadDelimited(&buf, &out2)
if err != nil {
panic(err)
}
fmt.Printf("Read message 2 (%d bytes): %s\n", r2, out2.GetValue())
// Read past end returns EOF
var out3 wrappers.StringValue
_, err = pbutil.ReadDelimited(&buf, &out3)
if err == io.EOF {
fmt.Println("Reached end of stream (EOF)")
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/matttproud/golang_protobuf_extensions@v1.0.1"
],
"symbols": [
"pbutil.ReadDelimited",
"pbutil.WriteDelimited"
]
}
package test
import (
"bytes"
"io"
"testing"
"github.com/golang/protobuf/ptypes/wrappers"
"github.com/matttproud/golang_protobuf_extensions/pbutil"
)
func TestWriteAndReadDelimited(t *testing.T) {
var buf bytes.Buffer
msg1 := &wrappers.StringValue{Value: "hello world"}
msg2 := &wrappers.StringValue{Value: "another message"}
n1, err := pbutil.WriteDelimited(&buf, msg1)
if err != nil {
t.Fatalf("WriteDelimited(msg1) failed: %v", err)
}
if n1 <= 0 {
t.Fatalf("WriteDelimited(msg1) returned byte count <= 0: %d", n1)
}
n2, err := pbutil.WriteDelimited(&buf, msg2)
if err != nil {
t.Fatalf("WriteDelimited(msg2) failed: %v", err)
}
if n2 <= 0 {
t.Fatalf("WriteDelimited(msg2) returned byte count <= 0: %d", n2)
}
var read1 wrappers.StringValue
r1, err := pbutil.ReadDelimited(&buf, &read1)
if err != nil {
t.Fatalf("ReadDelimited(read1) failed: %v", err)
}
if r1 != n1 {
t.Errorf("ReadDelimited read %d bytes, want %d bytes", r1, n1)
}
if read1.GetValue() != "hello world" {
t.Errorf("read1.GetValue() = %q, want %q", read1.GetValue(), "hello world")
}
var read2 wrappers.StringValue
r2, err := pbutil.ReadDelimited(&buf, &read2)
if err != nil {
t.Fatalf("ReadDelimited(read2) failed: %v", err)
}
if r2 != n2 {
t.Errorf("ReadDelimited read %d bytes, want %d bytes", r2, n2)
}
if read2.GetValue() != "another message" {
t.Errorf("read2.GetValue() = %q, want %q", read2.GetValue(), "another message")
}
}
func TestReadDelimitedEOF(t *testing.T) {
emptyBuf := bytes.NewReader([]byte{})
var msg wrappers.StringValue
n, err := pbutil.ReadDelimited(emptyBuf, &msg)
if err != io.EOF {
t.Errorf("ReadDelimited on empty reader expected io.EOF, got %v", err)
}
if n != 0 {
t.Errorf("ReadDelimited on empty reader returned %d bytes, want 0", n)
}
}
func TestReadDelimitedTruncated(t *testing.T) {
// A varint header indicating a 20-byte payload, but only 3 bytes provided
truncatedData := []byte{20, 1, 2, 3}
reader := bytes.NewReader(truncatedData)
var msg wrappers.StringValue
_, err := pbutil.ReadDelimited(reader, &msg)
if err == nil {
t.Fatal("ReadDelimited on truncated data expected error, got nil")
}
}
Origin Seeder
anonymous