サンプル
golang.org/x/sys v0.40.0
検証済みサンプル — golang golang.org/x/sys v0.40.0. go 1.26 · linux debian/x64 · docker で contract を実行し、成功しました: unix.Getpid returns a positive process ID
sha256:fb9c411a2be5fa9a672e8254bcf4271fc4c852014d2dcb89948cca41542c351b
このネットワークが提供するのは一つだけです。ビルドされるサンプル。サンドボックスで実行し、署名済みの受領証を保管します。等級はつけず、何も保証しません — 同じコードがあなたの環境でビルドされるかは測定していません。
合格した契約受領証を提出した異なる署名鍵の数です。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-11 |
ケース
HOW- ゴール
- verify pkg:golang/golang.org/x/sys@v0.40.0
- パッケージ
- 作成日
- 2026-10-11T09:29:13Z
コントラクト
- unix.Getpid returns a positive process ID
- unix.Getppid returns a non-negative parent process ID
- unix.Getpagesize returns a positive power-of-two page size
- unix.ByteSliceToString parses null-terminated C strings
- unix.TimevalToNsec converts a unix.Timeval struct into nanoseconds
- unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct
- unix.TimespecToNsec converts a unix.Timespec struct into nanoseconds
- unix.NsecToTimespec converts nanoseconds into a unix.Timespec struct
ファイル
- 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/golang.org/x/sys@v0.40.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/golang.org/x/sys@v0.40.0
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:24d16ca51c98782568afe068fa18a64db55c68aa77b466475ba5aaaf2bec498f","contract":["unix.Getpid returns a positive process ID","unix.Getppid returns a non-negative parent process ID","unix.Getpagesize returns a positive power-of-two page size","unix.ByteSliceToString parses null-terminated C strings","unix.TimevalToNsec converts a unix.Timeval struct into nanoseconds","unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct","unix.TimespecToNsec converts a unix.Timespec struct into nanoseconds","unix.NsecToTimespec converts nanoseconds into a unix.Timespec struct"],"goal":"verify pkg:golang/golang.org/x/sys@v0.40.0","kind":"HOW","packages":["pkg:golang/golang.org/x/sys@v0.40.0"],"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/golang.org/x/sys@v0.40.0"],"schemaVersion":1,"subject":"pkg:golang/golang.org/x/sys@v0.40.0","verifierAdapter":"golang@1"}
module example.com/sample
go 1.26.6
require golang.org/x/sys v0.40.0
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
package main
import (
"fmt"
"golang.org/x/sys/unix"
)
func main() {
pid := unix.Getpid()
ppid := unix.Getppid()
pageSize := unix.Getpagesize()
fmt.Printf("Process PID: %d, Parent PID: %d, Page size: %d\n", pid, ppid, pageSize)
tv := unix.Timeval{Sec: 1, Usec: 500000}
nsec := unix.TimevalToNsec(tv)
fmt.Printf("Timeval (%d sec, %d usec) -> %d ns\n", tv.Sec, tv.Usec, nsec)
str := unix.ByteSliceToString([]byte{'c', 's', 'x', 0, 't', 'e', 's', 't'})
fmt.Printf("ByteSliceToString -> %q\n", str)
}
{
"schemaVersion": 1,
"goal": "verify pkg:golang/golang.org/x/sys@v0.40.0",
"kind": "HOW",
"packages": [
"pkg:golang/golang.org/x/sys@v0.40.0"
]
}
package main
import (
"fmt"
"os"
"golang.org/x/sys/unix"
)
func main() {
// Assertion 1: unix.Getpid returns a positive process ID
pid := unix.Getpid()
if pid <= 0 {
fmt.Fprintf(os.Stderr, "FAIL: expected positive PID, got %d\n", pid)
os.Exit(1)
}
// Assertion 2: unix.Getppid returns a non-negative parent process ID
ppid := unix.Getppid()
if ppid < 0 {
fmt.Fprintf(os.Stderr, "FAIL: expected non-negative PPID, got %d\n", ppid)
os.Exit(1)
}
// Assertion 3: unix.Getpagesize returns a positive power-of-two page size
pageSize := unix.Getpagesize()
if pageSize <= 0 || (pageSize&(pageSize-1)) != 0 {
fmt.Fprintf(os.Stderr, "FAIL: expected positive power-of-two page size, got %d\n", pageSize)
os.Exit(1)
}
// Assertion 4: unix.ByteSliceToString parses null-terminated C strings
raw := []byte{'h', 'e', 'l', 'l', 'o', 0, 'w', 'o', 'r', 'l', 'd'}
parsed := unix.ByteSliceToString(raw)
if parsed != "hello" {
fmt.Fprintf(os.Stderr, "FAIL: expected 'hello', got %q\n", parsed)
os.Exit(1)
}
// Assertion 5: unix.TimevalToNsec converts a unix.Timeval struct into nanoseconds
tv := unix.Timeval{Sec: 2, Usec: 500000}
expectedNsec := int64(2500000000)
actualNsec := unix.TimevalToNsec(tv)
if actualNsec != expectedNsec {
fmt.Fprintf(os.Stderr, "FAIL: expected %d ns, got %d ns\n", expectedNsec, actualNsec)
os.Exit(1)
}
// Assertion 6: unix.NsecToTimeval converts nanoseconds into a unix.Timeval struct
convertedTv := unix.NsecToTimeval(expectedNsec)
if convertedTv.Sec != tv.Sec || convertedTv.Usec != tv.Usec {
fmt.Fprintf(os.Stderr, "FAIL: expected Timeval{Sec: %d, Usec: %d}, got %+v\n", tv.Sec, tv.Usec, convertedTv)
os.Exit(1)
}
// Assertion 7: unix.TimespecToNsec converts a unix.Timespec struct into nanoseconds
ts := unix.Timespec{Sec: 3, Nsec: 123456789}
expectedTsNsec := int64(3123456789)
actualTsNsec := unix.TimespecToNsec(ts)
if actualTsNsec != expectedTsNsec {
fmt.Fprintf(os.Stderr, "FAIL: expected %d ns, got %d ns\n", expectedTsNsec, actualTsNsec)
os.Exit(1)
}
// Assertion 8: unix.NsecToTimespec converts nanoseconds into a unix.Timespec struct
convertedTs := unix.NsecToTimespec(expectedTsNsec)
if convertedTs.Sec != ts.Sec || convertedTs.Nsec != ts.Nsec {
fmt.Fprintf(os.Stderr, "FAIL: expected Timespec{Sec: %d, Nsec: %d}, got %+v\n", ts.Sec, ts.Nsec, convertedTs)
os.Exit(1)
}
fmt.Println("PASS: all contract assertions passed successfully")
}
オリジンシーダー
匿名