サンプル
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7: serviceconfig.Service
検証済みサンプル — golang google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7: serviceconfig.Service. go 1.26 · linux debian/x64 · docker で…
sha256:e8acf53eecd350d0aed42ea2723a806861d7fdc8478230ab3a508c34bee2c9fd
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。1 なら作者だけ、2 以上なら他の誰かもビルドしています。鍵は自己生成で背後に登録された身元がないため、数えているのは人ではなく鍵です。
MIT-0
実行証拠
宣言された環境と署名済みの実行を分けてあります。このサンプルが何をどこで実行したかをそのまま確認できます。
- 証拠の基準
- 署名済みコントラクト合格
- 検証レシート
- 1
- ビルドした署名鍵
- 1
宣言された環境
linux 24 · ubuntu · glibc 2.39 x64 go
検証実行環境
| 環境 | コントラクト | ステージ | 実行日 |
|---|---|---|---|
| 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-01 |
ケース
HOW- ゴール
- verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
- シンボル
-
- google.golang.org/genproto/googleapis/api/serviceconfig.Service
- 作成日
- 2026-09-01T11:32:24Z
コントラクト
- serviceconfig.Service can be instantiated with Name, Title, Id, and ProducerProjectId
- Service.GetName returns the configured service name
- Service.GetTitle returns the configured service title
- Service.GetId returns the configured service ID
- Service.GetProducerProjectId returns the configured producer project ID
- NewService helper creates a configured serviceconfig.Service
- GetServiceName, GetServiceTitle, GetServiceId, and GetProducerProjectId return the respective field values
- GetServiceName returns empty string on nil service
ファイル
- PROMPT.md
- csx.json
- go.mod
- go.sum
- service.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/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7
Demonstrate these symbols/APIs:
- google.golang.org/genproto/googleapis/api/serviceconfig.Service
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:c975b0f430bdffcfc2e2e41ca03289c26283265e4216cb3acd857d822ec40008","contract":["serviceconfig.Service can be instantiated with Name, Title, Id, and ProducerProjectId","Service.GetName returns the configured service name","Service.GetTitle returns the configured service title","Service.GetId returns the configured service ID","Service.GetProducerProjectId returns the configured producer project ID","NewService helper creates a configured serviceconfig.Service","GetServiceName, GetServiceTitle, GetServiceId, and GetProducerProjectId return the respective field values","GetServiceName returns empty string on nil service"],"goal":"verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"symbols":["google.golang.org/genproto/googleapis/api/serviceconfig.Service"]},"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/api@v0.0.0-20240826202546-f6391c0de4c7"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7","symbols":["google.golang.org/genproto/googleapis/api/serviceconfig.Service"],"verifierAdapter":"golang@1"}
module sample
go 1.22
require google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7
require google.golang.org/protobuf v1.34.2 // indirect
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 h1:YcyjlL1PRr2Q17/I0dPk2JmYS5CDXfcdb2Z3YRioEbw=
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
package sample
import (
"google.golang.org/genproto/googleapis/api/serviceconfig"
)
// NewService creates a new serviceconfig.Service instance with provided metadata.
func NewService(name, title, id, producerProjectId string) *serviceconfig.Service {
return &serviceconfig.Service{
Name: name,
Title: title,
Id: id,
ProducerProjectId: producerProjectId,
}
}
// GetServiceName returns the name of the service using GetName().
func GetServiceName(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetName()
}
// GetServiceTitle returns the title of the service using GetTitle().
func GetServiceTitle(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetTitle()
}
// GetServiceId returns the ID of the service using GetId().
func GetServiceId(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetId()
}
// GetProducerProjectId returns the producer project ID of the service using GetProducerProjectId().
func GetProducerProjectId(svc *serviceconfig.Service) string {
if svc == nil {
return ""
}
return svc.GetProducerProjectId()
}
{
"schemaVersion": 1,
"goal": "verify google.golang.org/genproto/googleapis/api/serviceconfig.Service in pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto/googleapis/api@v0.0.0-20240826202546-f6391c0de4c7"
],
"symbols": [
"google.golang.org/genproto/googleapis/api/serviceconfig.Service"
]
}
package main
import (
"fmt"
"os"
"google.golang.org/genproto/googleapis/api/serviceconfig"
"sample"
)
func main() {
// Assertion 1: instantiate serviceconfig.Service directly
svc := &serviceconfig.Service{
Name: "endpoints.example.com",
Title: "Example API",
Id: "2024-08-26r0",
ProducerProjectId: "example-project-123",
}
// Assertion 2: GetName returns the service name
if got := svc.GetName(); got != "endpoints.example.com" {
fmt.Fprintf(os.Stderr, "expected GetName() to return %q, got %q\n", "endpoints.example.com", got)
os.Exit(1)
}
// Assertion 3: GetTitle returns the service title
if got := svc.GetTitle(); got != "Example API" {
fmt.Fprintf(os.Stderr, "expected GetTitle() to return %q, got %q\n", "Example API", got)
os.Exit(1)
}
// Assertion 4: GetId returns the service ID
if got := svc.GetId(); got != "2024-08-26r0" {
fmt.Fprintf(os.Stderr, "expected GetId() to return %q, got %q\n", "2024-08-26r0", got)
os.Exit(1)
}
// Assertion 5: GetProducerProjectId returns the producer project ID
if got := svc.GetProducerProjectId(); got != "example-project-123" {
fmt.Fprintf(os.Stderr, "expected GetProducerProjectId() to return %q, got %q\n", "example-project-123", got)
os.Exit(1)
}
// Assertion 6: Helper NewService initializes fields properly
helperSvc := sample.NewService("endpoints.example.com", "Example API", "2024-08-26r0", "example-project-123")
if helperSvc == nil {
fmt.Fprintf(os.Stderr, "expected NewService to return non-nil\n")
os.Exit(1)
}
// Assertion 7: Helper functions extract correct field values
if got := sample.GetServiceName(helperSvc); got != "endpoints.example.com" {
fmt.Fprintf(os.Stderr, "expected GetServiceName() to return %q, got %q\n", "endpoints.example.com", got)
os.Exit(1)
}
if got := sample.GetServiceTitle(helperSvc); got != "Example API" {
fmt.Fprintf(os.Stderr, "expected GetServiceTitle() to return %q, got %q\n", "Example API", got)
os.Exit(1)
}
if got := sample.GetServiceId(helperSvc); got != "2024-08-26r0" {
fmt.Fprintf(os.Stderr, "expected GetServiceId() to return %q, got %q\n", "2024-08-26r0", got)
os.Exit(1)
}
if got := sample.GetProducerProjectId(helperSvc); got != "example-project-123" {
fmt.Fprintf(os.Stderr, "expected GetProducerProjectId() to return %q, got %q\n", "example-project-123", got)
os.Exit(1)
}
// Assertion 8: Nil safety in helper functions
if got := sample.GetServiceName(nil); got != "" {
fmt.Fprintf(os.Stderr, "expected GetServiceName(nil) to return empty string, got %q\n", got)
os.Exit(1)
}
fmt.Println("All google.golang.org/genproto/googleapis/api/serviceconfig.Service contract assertions passed.")
}
オリジンシーダー
匿名