샘플
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7: errdetails.RequestInfo
검증된 샘플 — golang google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7: errdetails.RequestInfo. go 1.26 · linux alpine/x64 · docker에서…
sha256:8297d254ab546dc9843b1ed9801b2ba62b3dad85934e596caee1b87f208dd4b7
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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-27 |
케이스
HOW- 목표
- verify google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7
- 심벌
-
- google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo
- 생성일
- 2026-08-27T17:31:33Z
컨트랙트
- RequestInfo correctly stores and returns RequestId and ServingData fields via getters
- Getters return safe empty string defaults when called on a nil RequestInfo pointer
- RequestInfo correctly serializes to and deserializes from protocol buffer binary format
- Reset clears all fields of a RequestInfo instance to their zero values
- ProtoReflect returns a valid Message descriptor matching google.rpc.RequestInfo full name
파일
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
소스
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 google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7
Demonstrate these symbols/APIs:
- google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo
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:524d89c03945786edfcfefd423638f16a388ce1e228e0ea85249ba05795de46a","contract":["RequestInfo correctly stores and returns RequestId and ServingData fields via getters","Getters return safe empty string defaults when called on a nil RequestInfo pointer","RequestInfo correctly serializes to and deserializes from protocol buffer binary format","Reset clears all fields of a RequestInfo instance to their zero values","ProtoReflect returns a valid Message descriptor matching google.rpc.RequestInfo full name"],"goal":"verify google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"symbols":["google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo"]},"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/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7","symbols":["google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo"],"verifierAdapter":"golang@1"}
module example.com/sample
go 1.22.0
require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7
google.golang.org/protobuf v1.34.2
)
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 h1:2035KHhUv+EpyB+hWgJnaWKJOdX1E95w2S8Rr4uWKTs=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
package main
import (
"fmt"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/protobuf/proto"
)
// CreateRequestInfo creates a RequestInfo instance with the given request ID and serving data.
func CreateRequestInfo(requestID, servingData string) *errdetails.RequestInfo {
return &errdetails.RequestInfo{
RequestId: requestID,
ServingData: servingData,
}
}
// MarshalRequestInfo serializes a RequestInfo proto message to binary format.
func MarshalRequestInfo(info *errdetails.RequestInfo) ([]byte, error) {
return proto.Marshal(info)
}
// UnmarshalRequestInfo deserializes binary data into a RequestInfo proto message.
func UnmarshalRequestInfo(data []byte) (*errdetails.RequestInfo, error) {
var info errdetails.RequestInfo
if err := proto.Unmarshal(data, &info); err != nil {
return nil, err
}
return &info, nil
}
func main() {
info := CreateRequestInfo("req-12345-abcde", "cluster-us-east-1a:service-worker-42")
fmt.Printf("Request ID: %s\n", info.GetRequestId())
fmt.Printf("Serving Data: %s\n", info.GetServingData())
data, err := MarshalRequestInfo(info)
if err != nil {
panic(err)
}
decoded, err := UnmarshalRequestInfo(data)
if err != nil {
panic(err)
}
fmt.Printf("Decoded Request ID: %s\n", decoded.GetRequestId())
}
{
"schemaVersion": 1,
"goal": "verify google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo in pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20240826202546-f6391c0de4c7"
],
"symbols": [
"google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
)
func main() {
// Assertion 1: RequestInfo correctly stores and returns RequestId and ServingData fields via getters
req := &errdetails.RequestInfo{
RequestId: "req-trace-987654",
ServingData: "us-west2/pod-981-worker",
}
if got := req.GetRequestId(); got != "req-trace-987654" {
fmt.Fprintf(os.Stderr, "FAIL: GetRequestId mismatch: got %q, want %q\n", got, "req-trace-987654")
os.Exit(1)
}
if got := req.GetServingData(); got != "us-west2/pod-981-worker" {
fmt.Fprintf(os.Stderr, "FAIL: GetServingData mismatch: got %q, want %q\n", got, "us-west2/pod-981-worker")
os.Exit(1)
}
// Assertion 2: Getters return safe empty string defaults when called on a nil RequestInfo pointer
var nilReq *errdetails.RequestInfo
if got := nilReq.GetRequestId(); got != "" {
fmt.Fprintf(os.Stderr, "FAIL: nil GetRequestId expected empty string, got %q\n", got)
os.Exit(1)
}
if got := nilReq.GetServingData(); got != "" {
fmt.Fprintf(os.Stderr, "FAIL: nil GetServingData expected empty string, got %q\n", got)
os.Exit(1)
}
// Assertion 3: RequestInfo correctly serializes to and deserializes from protocol buffer binary format
data, err := proto.Marshal(req)
if err != nil {
fmt.Fprintf(os.Stderr, "FAIL: proto.Marshal failed: %v\n", err)
os.Exit(1)
}
if len(data) == 0 {
fmt.Fprintf(os.Stderr, "FAIL: marshaled proto data is empty\n")
os.Exit(1)
}
var unmarshaled errdetails.RequestInfo
if err := proto.Unmarshal(data, &unmarshaled); err != nil {
fmt.Fprintf(os.Stderr, "FAIL: proto.Unmarshal failed: %v\n", err)
os.Exit(1)
}
if !proto.Equal(req, &unmarshaled) {
fmt.Fprintf(os.Stderr, "FAIL: unmarshaled proto does not equal original\n")
os.Exit(1)
}
// Assertion 4: Reset clears all fields of a RequestInfo instance to their zero values
copyReq := &errdetails.RequestInfo{
RequestId: "temp-id",
ServingData: "temp-data",
}
copyReq.Reset()
if copyReq.GetRequestId() != "" || copyReq.GetServingData() != "" {
fmt.Fprintf(os.Stderr, "FAIL: Reset failed to clear all fields\n")
os.Exit(1)
}
// Assertion 5: ProtoReflect returns a valid Message descriptor matching google.rpc.RequestInfo full name
msg := req.ProtoReflect()
descriptor := msg.Descriptor()
if string(descriptor.FullName()) != "google.rpc.RequestInfo" {
fmt.Fprintf(os.Stderr, "FAIL: Descriptor FullName mismatch: got %q, want %q\n", descriptor.FullName(), "google.rpc.RequestInfo")
os.Exit(1)
}
reqIdField := descriptor.Fields().ByName(protoreflect.Name("request_id"))
if reqIdField == nil {
fmt.Fprintf(os.Stderr, "FAIL: field descriptor for request_id not found\n")
os.Exit(1)
}
servingDataField := descriptor.Fields().ByName(protoreflect.Name("serving_data"))
if servingDataField == nil {
fmt.Fprintf(os.Stderr, "FAIL: field descriptor for serving_data not found\n")
os.Exit(1)
}
fmt.Println("PASS: google.golang.org/genproto/googleapis/rpc/errdetails.RequestInfo contract verified")
}
오리진 시더
익명