Ejemplo
github.com/stretchr/objx v0.5.3: FromJSON
Muestra verificada para golang github.com/stretchr/objx v0.5.3: FromJSON. El contrato se ejecutó en go 1.26 · linux debian/x64 · docker y pasó.
sha256:bbcc4f9e0900b4efa64dc55c62c2655f1cb4026fa6c6811bcfcc9fb4ed37a4b3
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
linux 24 · ubuntu · glibc 2.39 x64 go
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-10-27 |
Caso
HOW- Objetivo
- verify github.com/stretchr/objx.FromJSON in pkg:golang/github.com/stretchr/objx@v0.5.3
- Paquetes
- Símbolos
-
- github.com/stretchr/objx.FromJSON
- Creado
- 2026-10-27T21:27:15Z
Contrato
- objx.FromJSON parses a valid JSON object string into an objx.Map
- objx.FromJSON returns an error when given invalid JSON syntax
- objx.FromJSON preserves nested JSON structures accessible via dot-separated selectors
Archivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
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 github.com/stretchr/objx.FromJSON in pkg:golang/github.com/stretchr/objx@v0.5.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/stretchr/objx@v0.5.3
Demonstrate these symbols/APIs:
- github.com/stretchr/objx.FromJSON
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:943c7ae6c2c8cd7cb3bf1d5f5e29cb4733b8ce0680d0bf329c6c949d29ee8387","contract":["objx.FromJSON parses a valid JSON object string into an objx.Map","objx.FromJSON returns an error when given invalid JSON syntax","objx.FromJSON preserves nested JSON structures accessible via dot-separated selectors"],"goal":"verify github.com/stretchr/objx.FromJSON in pkg:golang/github.com/stretchr/objx@v0.5.3","kind":"HOW","packages":["pkg:golang/github.com/stretchr/objx@v0.5.3"],"schemaVersion":1,"symbols":["github.com/stretchr/objx.FromJSON"]},"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/stretchr/objx@v0.5.3"],"schemaVersion":1,"subject":"pkg:golang/github.com/stretchr/objx@v0.5.3","symbols":["github.com/stretchr/objx.FromJSON"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.23
require github.com/stretchr/objx v0.5.3
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
package main
import (
"fmt"
"github.com/stretchr/objx"
)
func main() {
rawJSON := `{"service":"gateway","config":{"timeout":30},"active":true}`
m, err := objx.FromJSON(rawJSON)
if err != nil {
panic(err)
}
fmt.Printf("Service: %s\n", m.Get("service").Str())
fmt.Printf("Timeout: %d\n", m.Get("config.timeout").Int())
fmt.Printf("Active: %t\n", m.Get("active").Bool())
}
{
"schemaVersion": 1,
"goal": "verify github.com/stretchr/objx.FromJSON in pkg:golang/github.com/stretchr/objx@v0.5.3",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/stretchr/objx@v0.5.3"
],
"symbols": [
"github.com/stretchr/objx.FromJSON"
]
}
package main
import (
"fmt"
"os"
"github.com/stretchr/objx"
)
func main() {
// Assertion 1: objx.FromJSON parses a valid JSON object string into an objx.Map
validJSON := `{"service":"gateway","active":true}`
m1, err1 := objx.FromJSON(validJSON)
if err1 != nil {
fmt.Fprintf(os.Stderr, "contract assertion 1 failed: unexpected error: %v\n", err1)
os.Exit(1)
}
if got := m1.Get("service").Str(); got != "gateway" {
fmt.Fprintf(os.Stderr, "contract assertion 1 failed: expected %q, got %q\n", "gateway", got)
os.Exit(1)
}
if got := m1.Get("active").Bool(); !got {
fmt.Fprintf(os.Stderr, "contract assertion 1 failed: expected active=true, got %t\n", got)
os.Exit(1)
}
// Assertion 2: objx.FromJSON returns an error when given invalid JSON syntax
invalidJSON := `{"service": "gateway", invalid}`
_, err2 := objx.FromJSON(invalidJSON)
if err2 == nil {
fmt.Fprintf(os.Stderr, "contract assertion 2 failed: expected error for invalid JSON, got nil\n")
os.Exit(1)
}
// Assertion 3: objx.FromJSON preserves nested JSON structures accessible via dot-separated selectors
nestedJSON := `{"server":{"host":"localhost","port":8080},"tags":["api","auth"]}`
m3, err3 := objx.FromJSON(nestedJSON)
if err3 != nil {
fmt.Fprintf(os.Stderr, "contract assertion 3 failed: unexpected error: %v\n", err3)
os.Exit(1)
}
if got := m3.Get("server.host").Str(); got != "localhost" {
fmt.Fprintf(os.Stderr, "contract assertion 3 failed: expected server.host %q, got %q\n", "localhost", got)
os.Exit(1)
}
if got := m3.Get("server.port").Int(); got != 8080 {
fmt.Fprintf(os.Stderr, "contract assertion 3 failed: expected server.port 8080, got %d\n", got)
os.Exit(1)
}
if got := m3.Get("tags[0]").Str(); got != "api" {
fmt.Fprintf(os.Stderr, "contract assertion 3 failed: expected tags[0] %q, got %q\n", "api", got)
os.Exit(1)
}
fmt.Println("All contract assertions passed.")
}
Seeder de origen
anónimo