Ejemplo
github.com/go-stack/stack v1.8.0: Call.Frame
Muestra verificada para golang github.com/go-stack/stack v1.8.0: Call.Frame. El contrato se ejecutó en go 1.26 · linux debian/x64 · docker y pasó.
sha256:1d6cdebbffb4c845593a2e42b282c60f94ac49a81fa0444537d7f25224bb9410
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 1
- Claves de firma que lo compilaron
- 1
Entorno declarado
go 1.26 linux 24 · ubuntu · glibc 2.39 amd64 go 1.26 go 1.26 go 1
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| 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-09-03 |
Caso
HOW- Objetivo
- verify pkg:golang/github.com/go-stack/stack@v1.8.0
- Paquetes
- Símbolos
-
- stack.Call.Frame
- Entorno
- go 1.26.6
- Creado
- 2026-09-03T17:53:52Z
Contrato
- stack.Call.Frame returns runtime.Frame with valid PC, entry point, function name, file and line
- stack.Call.Frame extracts runtime.Frame directly from a Call without string parsing
- stack.Call.Frame matches call.PC program counter value
- stack.Call.Frame on zero-value Call returns empty runtime.Frame
Archivos
- PROMPT.md
- contract_test.go
- csx.json
- go.mod
- go.sum
- sample.go
- spec.json
Código fuente
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/go-stack/stack@v1.8.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/go-stack/stack@v1.8.0
Demonstrate these symbols/APIs:
- stack.Call.Frame
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.
package sample
import (
"runtime"
"strings"
"testing"
"github.com/go-stack/stack"
)
func levelA() (stack.Call, runtime.Frame) {
c := stack.Caller(0)
return c, c.Frame()
}
func levelB() runtime.Frame {
return GetCallerFrame(0)
}
func TestContractCallFrame(t *testing.T) {
call, frame := levelA()
// 1. Verify PC matches call.PC() and is non-zero
if frame.PC == 0 {
t.Fatalf("expected non-zero PC in runtime.Frame")
}
if frame.PC != call.PC() {
t.Fatalf("expected frame.PC == call.PC(), got %d != %d", frame.PC, call.PC())
}
// 2. Verify Function name contains the function symbol
if !strings.HasSuffix(frame.Function, "levelA") {
t.Fatalf("expected frame.Function ending with 'levelA', got %q", frame.Function)
}
// 3. Verify File path contains contract_test.go
if !strings.HasSuffix(frame.File, "contract_test.go") {
t.Fatalf("expected frame.File ending with 'contract_test.go', got %q", frame.File)
}
// 4. Verify Line number is positive
if frame.Line <= 0 {
t.Fatalf("expected positive line number, got %d", frame.Line)
}
// 5. Verify Entry point is valid
if frame.Entry == 0 {
t.Fatalf("expected non-zero entry point in runtime.Frame")
}
// 6. Verify caller frame via GetCallerFrame helper
frameB := levelB()
if !strings.HasSuffix(frameB.Function, "levelB") {
t.Fatalf("expected frameB.Function ending with 'levelB', got %q", frameB.Function)
}
// 7. Verify GetFrameFromCall matches call.Frame()
extracted := GetFrameFromCall(call)
if extracted != frame {
t.Fatalf("expected extracted frame to match direct call.Frame()")
}
// 8. Verify zero-value Call returns empty runtime.Frame
var zero stack.Call
if zero.Frame() != (runtime.Frame{}) {
t.Fatalf("expected empty runtime.Frame for zero-value Call, got %+v", zero.Frame())
}
}
{"case":{"caseId":"case:sha256:57642afdd39dcede28959f74dc611256022b14f47ad77707078ac6ee7c422ed8","contract":["stack.Call.Frame returns runtime.Frame with valid PC, entry point, function name, file and line","stack.Call.Frame extracts runtime.Frame directly from a Call without string parsing","stack.Call.Frame matches call.PC program counter value","stack.Call.Frame on zero-value Call returns empty runtime.Frame"],"goal":"verify pkg:golang/github.com/go-stack/stack@v1.8.0","kind":"HOW","packages":["pkg:golang/github.com/go-stack/stack@v1.8.0"],"schemaVersion":1,"symbols":["stack.Call.Frame"]},"contractCommand":["go","test","./..."],"environment":{"arch":"amd64","compiler":"go","compilerVersion":"1.26.6","distro":"ubuntu","ecosystem":"golang","language":"go","languageVersion":"1.26.6","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/go-stack/stack@v1.8.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/go-stack/stack@v1.8.0","symbols":["stack.Call.Frame"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require github.com/go-stack/stack v1.8.0
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
package sample
import (
"runtime"
"github.com/go-stack/stack"
)
// GetCallerFrame returns the runtime.Frame of the caller at the given skip depth.
func GetCallerFrame(skip int) runtime.Frame {
call := stack.Caller(skip + 1)
return call.Frame()
}
// GetFrameFromCall extracts the runtime.Frame directly from a stack.Call record.
func GetFrameFromCall(c stack.Call) runtime.Frame {
return c.Frame()
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/github.com/go-stack/stack@v1.8.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/go-stack/stack@v1.8.0"
],
"symbols": [
"stack.Call.Frame"
]
}
Seeder de origen
anónimo