サンプル
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51
検証済みサンプル — golang google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51. go 1.26 · linux debian/x64 · docker で contract を実行し、成功しました.
sha256:baefdcd8a17bff8260a6a9b21e711f77bb6ccf68ecfca982b08ea0ff64f986a7
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-10-21 |
ケース
HOW- ゴール
- verify pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51
- 作成日
- 2026-10-21T04:51:48Z
コントラクト
- date.Date.GetYear, GetMonth, and GetDay return 0 on nil or zero-valued instances and return configured fields on populated instances.
- latlng.LatLng.GetLatitude and GetLongitude return 0.0 on nil or zero-valued instances and return configured coordinates on populated instances.
- date.Date marshals to protobuf wire format and unmarshals back preserving Year, Month, and Day.
- latlng.LatLng marshals to protobuf wire format and unmarshals back preserving Latitude and Longitude.
- (*date.Date).Reset and (*latlng.LatLng).Reset clear all fields back to their zero values.
ファイル
- 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 pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51
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:05d17601a533b39524acffbd3ae8e24fe1740b9e366fde2d60ecdfb36b724e11","contract":["date.Date.GetYear, GetMonth, and GetDay return 0 on nil or zero-valued instances and return configured fields on populated instances.","latlng.LatLng.GetLatitude and GetLongitude return 0.0 on nil or zero-valued instances and return configured coordinates on populated instances.","date.Date marshals to protobuf wire format and unmarshals back preserving Year, Month, and Day.","latlng.LatLng marshals to protobuf wire format and unmarshals back preserving Latitude and Longitude.","(*date.Date).Reset and (*latlng.LatLng).Reset clear all fields back to their zero values."],"goal":"verify pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51","kind":"HOW","packages":["pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51"],"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@v0.0.0-20190911173649-1774047e7e51"],"schemaVersion":1,"subject":"pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51","verifierAdapter":"golang@1"}
module example.com/verify
go 1.21
require (
github.com/golang/protobuf v1.3.2
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51
)
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U=
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
package main
import (
"fmt"
"github.com/golang/protobuf/proto"
"google.golang.org/genproto/googleapis/type/date"
"google.golang.org/genproto/googleapis/type/latlng"
)
func main() {
d := &date.Date{
Year: 2019,
Month: 9,
Day: 11,
}
fmt.Printf("Date: %04d-%02d-%02d\n", d.GetYear(), d.GetMonth(), d.GetDay())
loc := &latlng.LatLng{
Latitude: 37.422,
Longitude: -122.084,
}
fmt.Printf("Location: lat=%f, lng=%f\n", loc.GetLatitude(), loc.GetLongitude())
data, err := proto.Marshal(d)
if err != nil {
panic(err)
}
var decoded date.Date
if err := proto.Unmarshal(data, &decoded); err != nil {
panic(err)
}
fmt.Printf("Decoded date: %04d-%02d-%02d\n", decoded.GetYear(), decoded.GetMonth(), decoded.GetDay())
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51",
"kind": "HOW",
"packages": [
"pkg:golang/google.golang.org/genproto@v0.0.0-20190911173649-1774047e7e51"
]
}
package main
import (
"fmt"
"math"
"os"
"github.com/golang/protobuf/proto"
"google.golang.org/genproto/googleapis/type/date"
"google.golang.org/genproto/googleapis/type/latlng"
)
func main() {
// Assertion 1: date.Date.GetYear, GetMonth, and GetDay return 0 on nil or zero-valued instances and return configured fields on populated instances.
{
var nilDate *date.Date
if nilDate.GetYear() != 0 || nilDate.GetMonth() != 0 || nilDate.GetDay() != 0 {
fmt.Fprintf(os.Stderr, "assertion 1 failed: nil date getters must return 0\n")
os.Exit(1)
}
emptyDate := &date.Date{}
if emptyDate.GetYear() != 0 || emptyDate.GetMonth() != 0 || emptyDate.GetDay() != 0 {
fmt.Fprintf(os.Stderr, "assertion 1 failed: empty date getters must return 0\n")
os.Exit(1)
}
d := &date.Date{Year: 2019, Month: 9, Day: 11}
if d.GetYear() != 2019 || d.GetMonth() != 9 || d.GetDay() != 11 {
fmt.Fprintf(os.Stderr, "assertion 1 failed: populated date getters mismatch\n")
os.Exit(1)
}
}
// Assertion 2: latlng.LatLng.GetLatitude and GetLongitude return 0.0 on nil or zero-valued instances and return configured coordinates on populated instances.
{
var nilLatLng *latlng.LatLng
if nilLatLng.GetLatitude() != 0.0 || nilLatLng.GetLongitude() != 0.0 {
fmt.Fprintf(os.Stderr, "assertion 2 failed: nil latlng getters must return 0.0\n")
os.Exit(1)
}
emptyLatLng := &latlng.LatLng{}
if emptyLatLng.GetLatitude() != 0.0 || emptyLatLng.GetLongitude() != 0.0 {
fmt.Fprintf(os.Stderr, "assertion 2 failed: empty latlng getters must return 0.0\n")
os.Exit(1)
}
pos := &latlng.LatLng{Latitude: 37.422, Longitude: -122.084}
if math.Abs(pos.GetLatitude()-37.422) > 1e-6 || math.Abs(pos.GetLongitude()-(-122.084)) > 1e-6 {
fmt.Fprintf(os.Stderr, "assertion 2 failed: populated latlng getters mismatch\n")
os.Exit(1)
}
}
// Assertion 3: date.Date marshals to protobuf wire format and unmarshals back preserving Year, Month, and Day.
{
orig := &date.Date{Year: 2019, Month: 9, Day: 11}
data, err := proto.Marshal(orig)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: marshal failed: %v\n", err)
os.Exit(1)
}
if len(data) == 0 {
fmt.Fprintf(os.Stderr, "assertion 3 failed: marshal returned empty bytes\n")
os.Exit(1)
}
var decoded date.Date
if err := proto.Unmarshal(data, &decoded); err != nil {
fmt.Fprintf(os.Stderr, "assertion 3 failed: unmarshal failed: %v\n", err)
os.Exit(1)
}
if decoded.GetYear() != 2019 || decoded.GetMonth() != 9 || decoded.GetDay() != 11 {
fmt.Fprintf(os.Stderr, "assertion 3 failed: unmarshaled values mismatch\n")
os.Exit(1)
}
}
// Assertion 4: latlng.LatLng marshals to protobuf wire format and unmarshals back preserving Latitude and Longitude.
{
orig := &latlng.LatLng{Latitude: -33.8688, Longitude: 151.2093}
data, err := proto.Marshal(orig)
if err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: marshal failed: %v\n", err)
os.Exit(1)
}
if len(data) == 0 {
fmt.Fprintf(os.Stderr, "assertion 4 failed: marshal returned empty bytes\n")
os.Exit(1)
}
var decoded latlng.LatLng
if err := proto.Unmarshal(data, &decoded); err != nil {
fmt.Fprintf(os.Stderr, "assertion 4 failed: unmarshal failed: %v\n", err)
os.Exit(1)
}
if math.Abs(decoded.GetLatitude()-orig.Latitude) > 1e-6 || math.Abs(decoded.GetLongitude()-orig.Longitude) > 1e-6 {
fmt.Fprintf(os.Stderr, "assertion 4 failed: unmarshaled coordinates mismatch\n")
os.Exit(1)
}
}
// Assertion 5: (*date.Date).Reset and (*latlng.LatLng).Reset clear all fields back to their zero values.
{
d := &date.Date{Year: 2019, Month: 9, Day: 11}
d.Reset()
if d.GetYear() != 0 || d.GetMonth() != 0 || d.GetDay() != 0 {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Reset did not clear date fields\n")
os.Exit(1)
}
pos := &latlng.LatLng{Latitude: 48.8566, Longitude: 2.3522}
pos.Reset()
if pos.GetLatitude() != 0.0 || pos.GetLongitude() != 0.0 {
fmt.Fprintf(os.Stderr, "assertion 5 failed: Reset did not clear latlng fields\n")
os.Exit(1)
}
}
fmt.Println("All contract assertions passed.")
}
オリジンシーダー
匿名