Exemplo
go.opentelemetry.io/otel/trace v1.24.0: NewSpanEndConfig
Amostra verificada para golang go.opentelemetry.io/otel/trace v1.24.0: NewSpanEndConfig. O contrato rodou em go 1.26 · linux debian/x64 · docker e passou.
sha256:76705f7b98a3a6aa37cab4206a8ae9a5ce232349c2c39f4d9386ccc888c228e1
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux 24 · ubuntu · glibc 2.39 x64 go
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| 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 go.opentelemetry.io/otel/trace.NewSpanEndConfig in pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0
- Símbolos
-
- go.opentelemetry.io/otel/trace.NewSpanEndConfig
- Criado
- 2026-09-03T01:30:07Z
Contrato
- NewSpanEndConfig returns default SpanConfig with zero timestamp and disabled stack trace when called with no options
- NewSpanEndConfig applies WithTimestamp option to configure end timestamp
- NewSpanEndConfig applies WithStackTrace option to configure stack trace capture
- NewSpanEndConfig applies multiple SpanEndOption configurations concurrently
- NewSpanEndConfig applies later SpanEndOption to overwrite earlier option value
Arquivos
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
Código-fonte
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 go.opentelemetry.io/otel/trace.NewSpanEndConfig in pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0
Demonstrate these symbols/APIs:
- go.opentelemetry.io/otel/trace.NewSpanEndConfig
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:833152995785f7ae0a2ae8b4cd7dac9ca0df22660f5b3678130d63304c05f7ec","contract":["NewSpanEndConfig returns default SpanConfig with zero timestamp and disabled stack trace when called with no options","NewSpanEndConfig applies WithTimestamp option to configure end timestamp","NewSpanEndConfig applies WithStackTrace option to configure stack trace capture","NewSpanEndConfig applies multiple SpanEndOption configurations concurrently","NewSpanEndConfig applies later SpanEndOption to overwrite earlier option value"],"goal":"verify go.opentelemetry.io/otel/trace.NewSpanEndConfig in pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0","kind":"HOW","packages":["pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0"],"schemaVersion":1,"symbols":["go.opentelemetry.io/otel/trace.NewSpanEndConfig"]},"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/go.opentelemetry.io/otel/trace@v1.24.0"],"schemaVersion":1,"subject":"pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0","symbols":["go.opentelemetry.io/otel/trace.NewSpanEndConfig"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.22
require (
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0
)
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
package main
import (
"context"
"fmt"
"time"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"
)
func main() {
tp := noop.NewTracerProvider()
tracer := tp.Tracer("example.com/trace-sample")
ctx := context.Background()
ctx, span := tracer.Start(ctx, "example-operation")
endTime := time.Now().UTC()
endConfig := trace.NewSpanEndConfig(
trace.WithTimestamp(endTime),
trace.WithStackTrace(true),
)
fmt.Printf("Span end config: timestamp=%v, stackTrace=%v\n",
endConfig.Timestamp(), endConfig.StackTrace())
span.End(
trace.WithTimestamp(endConfig.Timestamp()),
trace.WithStackTrace(endConfig.StackTrace()),
)
}
{
"schemaVersion": 1,
"goal": "verify go.opentelemetry.io/otel/trace.NewSpanEndConfig in pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0",
"kind": "HOW",
"packages": [
"pkg:golang/go.opentelemetry.io/otel/trace@v1.24.0"
],
"symbols": [
"go.opentelemetry.io/otel/trace.NewSpanEndConfig"
]
}
package main
import (
"fmt"
"os"
"time"
"go.opentelemetry.io/otel/trace"
)
func main() {
// 1. NewSpanEndConfig returns default SpanConfig with zero timestamp and disabled stack trace when called with no options
defaultCfg := trace.NewSpanEndConfig()
if !defaultCfg.Timestamp().IsZero() {
fmt.Fprintf(os.Stderr, "expected zero timestamp, got %v\n", defaultCfg.Timestamp())
os.Exit(1)
}
if defaultCfg.StackTrace() {
fmt.Fprintf(os.Stderr, "expected stackTrace false, got true\n")
os.Exit(1)
}
// 2. NewSpanEndConfig applies WithTimestamp option to configure end timestamp
expectedTime := time.Unix(1700000000, 123456789).UTC()
timeCfg := trace.NewSpanEndConfig(trace.WithTimestamp(expectedTime))
if !timeCfg.Timestamp().Equal(expectedTime) {
fmt.Fprintf(os.Stderr, "expected timestamp %v, got %v\n", expectedTime, timeCfg.Timestamp())
os.Exit(1)
}
// 3. NewSpanEndConfig applies WithStackTrace option to configure stack trace capture
stackCfg := trace.NewSpanEndConfig(trace.WithStackTrace(true))
if !stackCfg.StackTrace() {
fmt.Fprintf(os.Stderr, "expected stackTrace true, got false\n")
os.Exit(1)
}
// 4. NewSpanEndConfig applies multiple SpanEndOption configurations concurrently
multiCfg := trace.NewSpanEndConfig(
trace.WithTimestamp(expectedTime),
trace.WithStackTrace(true),
)
if !multiCfg.Timestamp().Equal(expectedTime) {
fmt.Fprintf(os.Stderr, "expected timestamp %v, got %v\n", expectedTime, multiCfg.Timestamp())
os.Exit(1)
}
if !multiCfg.StackTrace() {
fmt.Fprintf(os.Stderr, "expected stackTrace true, got false\n")
os.Exit(1)
}
// 5. NewSpanEndConfig applies later SpanEndOption to overwrite earlier option value
overwriteTime := expectedTime.Add(5 * time.Second)
overwrittenCfg := trace.NewSpanEndConfig(
trace.WithTimestamp(expectedTime),
trace.WithTimestamp(overwriteTime),
trace.WithStackTrace(true),
trace.WithStackTrace(false),
)
if !overwrittenCfg.Timestamp().Equal(overwriteTime) {
fmt.Fprintf(os.Stderr, "expected overwritten timestamp %v, got %v\n", overwriteTime, overwrittenCfg.Timestamp())
os.Exit(1)
}
if overwrittenCfg.StackTrace() {
fmt.Fprintf(os.Stderr, "expected overwritten stackTrace false, got true\n")
os.Exit(1)
}
fmt.Println("All contract assertions passed successfully.")
}
Seeder de origem
anônimo