Sample
github.com/chzyer/logex v1.2.1
Verified sample for golang github.com/chzyer/logex v1.2.1. The contract ran on go 1.26 · linux debian/x64 · docker and passed.
sha256:0e53c343a348dd664b2129fa3eb40fc4c9f2e5038d8f00e7e7ba56b290fabfca
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 go
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-22 |
Case
HOW- Goal
- verify pkg:golang/github.com/chzyer/logex@v1.2.1
- Packages
- Created
- 2026-10-22T07:11:35Z
Contract
- logex.NewLoggerEx writes level-prefixed log entries ([INFO], [WARN], [PRETTY]) to a custom io.Writer
- logex.Define and logex.Trace wrap errors with stack trace context while preserving nil inputs
- logex.Equal and logex.EqualAny match traced errors against their underlying sentinel error
- logex.NewErrorf and logex.DecodeError format and extract traced error messages
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- logex.go
- spec.json
- test/contract.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/chzyer/logex@v1.2.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/chzyer/logex@v1.2.1
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:7869d68b7db5efd117397301b802eea4d4919ed2fe13a2fb5deebbb40629eac3","contract":["logex.NewLoggerEx writes level-prefixed log entries ([INFO], [WARN], [PRETTY]) to a custom io.Writer","logex.Define and logex.Trace wrap errors with stack trace context while preserving nil inputs","logex.Equal and logex.EqualAny match traced errors against their underlying sentinel error","logex.NewErrorf and logex.DecodeError format and extract traced error messages"],"goal":"verify pkg:golang/github.com/chzyer/logex@v1.2.1","kind":"HOW","packages":["pkg:golang/github.com/chzyer/logex@v1.2.1"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/chzyer/logex@v1.2.1"],"schemaVersion":1,"subject":"pkg:golang/github.com/chzyer/logex@v1.2.1","verifierAdapter":"golang@1"}
module sample
go 1.21
require github.com/chzyer/logex v1.2.1
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
package sample
import (
"io"
"github.com/chzyer/logex"
)
// NewBufferLogger creates a logex Logger writing to w with source code display disabled.
func NewBufferLogger(w io.Writer) *logex.Logger {
logex.ShowCode = false
return logex.NewLoggerEx(w)
}
// WrapWithContext wraps an error with trace metadata using logex.Trace.
func WrapWithContext(err error, info ...interface{}) error {
return logex.Trace(err, info...)
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/chzyer/logex@v1.2.1",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/chzyer/logex@v1.2.1"
]
}
package main
import (
"bytes"
"errors"
"strings"
"sample"
"github.com/chzyer/logex"
)
func main() {
var buf bytes.Buffer
logger := sample.NewBufferLogger(&buf)
logger.Info("service started")
logger.Warnf("retry count=%d", 3)
logger.Pretty(map[string]int{"items": 2})
out := buf.String()
if !strings.Contains(out, "[INFO]") || !strings.Contains(out, "service started") {
panic("expected INFO log output, got: " + out)
}
if !strings.Contains(out, "[WARN]") || !strings.Contains(out, "retry count=3") {
panic("expected WARN log output, got: " + out)
}
if !strings.Contains(out, "[PRETTY]") || !strings.Contains(out, `"items": 2`) {
panic("expected PRETTY JSON log output, got: " + out)
}
sentinel := logex.Define("sentinel failure")
wrapped := sample.WrapWithContext(sentinel, "context layer")
if !logex.Equal(wrapped, sentinel) {
panic("expected wrapped trace error to match sentinel via logex.Equal")
}
if logex.Trace(nil, "ignored") != nil {
panic("expected logex.Trace(nil, ...) to return nil")
}
other := errors.New("other error")
if logex.Equal(wrapped, other) {
panic("expected wrapped trace error not to match unrelated error")
}
if !logex.EqualAny(wrapped, []error{other, sentinel}) {
panic("expected wrapped trace error to match sentinel in slice via logex.EqualAny")
}
if logex.EqualAny(wrapped, []error{other}) {
panic("expected wrapped trace error not to match slice without sentinel")
}
formatted := logex.NewErrorf("code=%d", 404)
if !strings.Contains(formatted.Error(), "code=404") {
panic("expected formatted error message")
}
if !strings.Contains(logex.DecodeError(wrapped), "sentinel failure") {
panic("expected DecodeError to include sentinel message")
}
}
Origin Seeder
anonymous