Sample
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4
Verified sample for golang google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4. The contract ran on go 1.26 · linux debian/x64 …
sha256:7f69d5163dd456194906995e5b53288b2e5dcb82ef0c13a5f3bd2bdbe501e9ca
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
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-09-06 |
Case
HOW- Goal
- verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4
- Created
- 2026-09-06T18:54:54Z
Contract
- errdetails.ErrorInfo stores reason, domain, and metadata key-value pairs accessible via GetReason, GetDomain, and GetMetadata.
- errdetails.ErrorInfo returns safe empty defaults when nil or uninitialized, with nil GetMetadata.
- errdetails.ErrorInfo serializes and deserializes accurately using proto.Marshal and proto.Unmarshal preserving reason, domain, and metadata entries.
- errdetails.ErrorInfo.Reset clears reason, domain, and metadata from the message.
- errdetails.ErrorInfo packs into anypb.Any for inclusion in status.Status details and unpacks cleanly with anypb.UnmarshalTo.
Files
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.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/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4
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:364f046b6d9637a0aebcf2500150496ed39111bbb5a282ab582c2f38c48f38df","contract":["errdetails.ErrorInfo stores reason, domain, and metadata key-value pairs accessible via GetReason, GetDomain, and GetMetadata.","errdetails.ErrorInfo returns safe empty defaults when nil or uninitialized, with nil GetMetadata.","errdetails.ErrorInfo serializes and deserializes accurately using proto.Marshal and proto.Unmarshal preserving reason, domain, and metadata entries.","errdetails.ErrorInfo.Reset clears reason, domain, and metadata from the message.","errdetails.ErrorInfo packs into anypb.Any for inclusion in status.Status details and unpacks cleanly with anypb.UnmarshalTo."],"goal":"verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4"],"schemaVersion":1},"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-20260904194346-d0f1323225a4"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4","verifierAdapter":"golang@1"}
module example.com/sample
go 1.25.0
require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4
google.golang.org/protobuf v1.36.12
)
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4 h1:5t+ZydAFj5kGVLrgCvLmpmCf9ylGRd64hpEronfRaws=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260904194346-d0f1323225a4/go.mod h1:DjtHYE8FKJLivXcBEjGwndXfIC23G0VpXiXKqG179uA=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
package main
import (
"fmt"
"log"
"google.golang.org/genproto/googleapis/rpc/code"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
func main() {
info := &errdetails.ErrorInfo{
Reason: "RESOURCE_QUOTA_EXCEEDED",
Domain: "example.com",
Metadata: map[string]string{
"quota_limit": "1000",
"quota_used": "1001",
},
}
fmt.Printf("Error Reason: %s\n", info.GetReason())
fmt.Printf("Error Domain: %s\n", info.GetDomain())
for k, v := range info.GetMetadata() {
fmt.Printf("Metadata [%s]: %s\n", k, v)
}
data, err := proto.Marshal(info)
if err != nil {
log.Fatalf("failed to marshal ErrorInfo: %v", err)
}
var decoded errdetails.ErrorInfo
if err := proto.Unmarshal(data, &decoded); err != nil {
log.Fatalf("failed to unmarshal ErrorInfo: %v", err)
}
fmt.Printf("Decoded Reason: %s\n", decoded.GetReason())
anyInfo, err := anypb.New(info)
if err != nil {
log.Fatalf("failed to pack ErrorInfo into Any: %v", err)
}
rpcStatus := &status.Status{
Code: int32(code.Code_RESOURCE_EXHAUSTED),
Message: "rate limit exceeded for project",
Details: []*anypb.Any{anyInfo},
}
fmt.Printf("Status: code=%d message=%s details=%d\n", rpcStatus.GetCode(), rpcStatus.GetMessage(), len(rpcStatus.GetDetails()))
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto/googleapis/rpc@v0.0.0-20260904194346-d0f1323225a4"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/rpc/code"
"google.golang.org/genproto/googleapis/rpc/errdetails"
"google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
)
func assert(cond bool, msg string) {
if !cond {
fmt.Fprintf(os.Stderr, "Assertion failed: %s\n", msg)
os.Exit(1)
}
}
func main() {
// 1. errdetails.ErrorInfo stores reason, domain, and metadata key-value pairs accessible via GetReason, GetDomain, and GetMetadata.
info := &errdetails.ErrorInfo{
Reason: "RESOURCE_QUOTA_EXCEEDED",
Domain: "example.com",
Metadata: map[string]string{
"quota_limit": "500",
"quota_used": "505",
},
}
assert(info.GetReason() == "RESOURCE_QUOTA_EXCEEDED", "reason mismatch")
assert(info.GetDomain() == "example.com", "domain mismatch")
assert(info.GetMetadata()["quota_limit"] == "500", "metadata quota_limit mismatch")
assert(info.GetMetadata()["quota_used"] == "505", "metadata quota_used mismatch")
// 2. errdetails.ErrorInfo returns safe empty defaults when nil or uninitialized, with nil GetMetadata.
var nilInfo *errdetails.ErrorInfo
assert(nilInfo.GetReason() == "", "nil ErrorInfo GetReason must be empty")
assert(nilInfo.GetDomain() == "", "nil ErrorInfo GetDomain must be empty")
assert(nilInfo.GetMetadata() == nil, "nil ErrorInfo GetMetadata must be nil")
emptyInfo := &errdetails.ErrorInfo{}
assert(emptyInfo.GetReason() == "", "empty ErrorInfo GetReason must be empty")
assert(emptyInfo.GetDomain() == "", "empty ErrorInfo GetDomain must be empty")
assert(emptyInfo.GetMetadata() == nil, "empty ErrorInfo GetMetadata must be nil")
// 3. errdetails.ErrorInfo serializes and deserializes accurately using proto.Marshal and proto.Unmarshal preserving reason, domain, and metadata entries.
data, err := proto.Marshal(info)
assert(err == nil, "proto.Marshal failed")
assert(len(data) > 0, "marshaled bytes empty")
var unmarshaled errdetails.ErrorInfo
err = proto.Unmarshal(data, &unmarshaled)
assert(err == nil, "proto.Unmarshal failed")
assert(unmarshaled.GetReason() == "RESOURCE_QUOTA_EXCEEDED", "unmarshaled reason mismatch")
assert(unmarshaled.GetDomain() == "example.com", "unmarshaled domain mismatch")
assert(unmarshaled.GetMetadata()["quota_limit"] == "500", "unmarshaled metadata mismatch")
assert(unmarshaled.GetMetadata()["quota_used"] == "505", "unmarshaled metadata mismatch")
// 4. errdetails.ErrorInfo.Reset clears reason, domain, and metadata from the message.
infoToReset := &errdetails.ErrorInfo{
Reason: "TEMP_ERROR",
Domain: "example.com",
Metadata: map[string]string{
"key": "value",
},
}
infoToReset.Reset()
assert(infoToReset.GetReason() == "", "reset reason must be empty")
assert(infoToReset.GetDomain() == "", "reset domain must be empty")
assert(infoToReset.GetMetadata() == nil, "reset metadata must be nil")
// 5. errdetails.ErrorInfo packs into anypb.Any for inclusion in status.Status details and unpacks cleanly with anypb.UnmarshalTo.
anyInfo, err := anypb.New(info)
assert(err == nil, "anypb.New failed")
st := &status.Status{
Code: int32(code.Code_RESOURCE_EXHAUSTED),
Message: "quota limit reached",
Details: []*anypb.Any{anyInfo},
}
assert(len(st.GetDetails()) == 1, "details count must be 1")
unpackedInfo := &errdetails.ErrorInfo{}
err = anypb.UnmarshalTo(st.GetDetails()[0], unpackedInfo, proto.UnmarshalOptions{})
assert(err == nil, "anypb.UnmarshalTo failed")
assert(unpackedInfo.GetReason() == "RESOURCE_QUOTA_EXCEEDED", "unpacked reason mismatch")
assert(unpackedInfo.GetDomain() == "example.com", "unpacked domain mismatch")
assert(unpackedInfo.GetMetadata()["quota_limit"] == "500", "unpacked metadata quota_limit mismatch")
fmt.Println("All contract assertions passed.")
}
Origin Seeder
anonymous