샘플
modernc.org/memory v1.11.0
검증된 샘플 — golang modernc.org/memory v1.11.0. go 1.26 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: memory.Allocator zero value is ready to allocate and…
sha256:029cb77b24a6edea4c8091ed6cf7682f9872c0de61e6c883bd3b2471cb7550af
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
windows 11 x64 go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1 |
2026-08-19 |
케이스
HOW- 목표
- verify pkg:golang/modernc.org/memory@v1.11.0
- 생성일
- 2026-08-18T17:41:26Z
컨트랙트
- memory.Allocator zero value is ready to allocate and free memory
- alloc.Malloc allocates a byte slice of the requested size without errors
- alloc.Realloc resizes an allocated memory block preserving existing contents
- alloc.Calloc allocates a zero-initialized byte slice of the requested size
- alloc.Free deallocates memory blocks without errors
- alloc.Close closes the allocator and releases OS memory resources
파일
- PROMPT.md
- csx.json
- go.mod
- go.sum
- 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/modernc.org/memory@v1.11.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/modernc.org/memory@v1.11.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:5347e44876c17ec489aa74b079a0435e08e9f88f084765f58023f45fdfe147f5","contract":["memory.Allocator zero value is ready to allocate and free memory","alloc.Malloc allocates a byte slice of the requested size without errors","alloc.Realloc resizes an allocated memory block preserving existing contents","alloc.Calloc allocates a zero-initialized byte slice of the requested size","alloc.Free deallocates memory blocks without errors","alloc.Close closes the allocator and releases OS memory resources"],"goal":"verify pkg:golang/modernc.org/memory@v1.11.0","kind":"HOW","packages":["pkg:golang/modernc.org/memory@v1.11.0"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","ecosystem":"golang","os":"windows","osVersionBucket":"11","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/modernc.org/memory@v1.11.0"],"schemaVersion":1,"verifierAdapter":"golang@1"}
module sample
go 1.23.0
require modernc.org/memory v1.11.0
require golang.org/x/sys v0.31.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
{
"schemaVersion": 1,
"goal": "verify pkg:golang/modernc.org/memory@v1.11.0",
"kind": "HOW",
"packages": [
"pkg:golang/modernc.org/memory@v1.11.0"
]
}
package main
import (
"bytes"
"fmt"
"os"
"modernc.org/memory"
)
func main() {
var alloc memory.Allocator
defer func() {
if err := alloc.Close(); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Close failed: %v\n", err)
os.Exit(1)
}
}()
// 1. Test Malloc
buf, err := alloc.Malloc(128)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Malloc(128) failed: %v\n", err)
os.Exit(1)
}
if len(buf) != 128 {
fmt.Fprintf(os.Stderr, "expected len 128, got %d\n", len(buf))
os.Exit(1)
}
// Write pattern to allocated buffer
for i := 0; i < len(buf); i++ {
buf[i] = byte(i % 256)
}
// 2. Test Realloc (expanding buffer)
buf, err = alloc.Realloc(buf, 256)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Realloc(buf, 256) failed: %v\n", err)
os.Exit(1)
}
if len(buf) != 256 {
fmt.Fprintf(os.Stderr, "expected len 256 after Realloc, got %d\n", len(buf))
os.Exit(1)
}
// Verify original contents preserved
for i := 0; i < 128; i++ {
if buf[i] != byte(i%256) {
fmt.Fprintf(os.Stderr, "data mismatch at index %d after Realloc: expected %d, got %d\n", i, byte(i%256), buf[i])
os.Exit(1)
}
}
// 3. Test Free
if err := alloc.Free(buf); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Free failed: %v\n", err)
os.Exit(1)
}
// 4. Test Calloc (zero-initialized allocation)
zeroBuf, err := alloc.Calloc(64)
if err != nil {
fmt.Fprintf(os.Stderr, "alloc.Calloc(64) failed: %v\n", err)
os.Exit(1)
}
if len(zeroBuf) != 64 {
fmt.Fprintf(os.Stderr, "expected len 64 from Calloc, got %d\n", len(zeroBuf))
os.Exit(1)
}
expectedZeros := make([]byte, 64)
if !bytes.Equal(zeroBuf, expectedZeros) {
fmt.Fprintf(os.Stderr, "expected Calloc buffer to be zero-filled\n")
os.Exit(1)
}
if err := alloc.Free(zeroBuf); err != nil {
fmt.Fprintf(os.Stderr, "alloc.Free(zeroBuf) failed: %v\n", err)
os.Exit(1)
}
fmt.Println("modernc.org/memory allocator contract verified successfully")
}
오리진 시더
익명