CodeSampleX

Beispiel

github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58

Verifiziertes Beispiel für golang github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58. Der Vertrag lief auf go 1.26 · linux alpine/x64 · docker und…

sha256:f1e886ee962e234358657de543bd846d1d5d22102b986ace9640802846fffc87

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 go

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-21

Fall

HOW
Ziel
verify pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58
Pakete
Erstellt
2026-08-21T00:19:47Z

Contract

  1. memory.TotalMemory returns a non-zero uint64 total system RAM in bytes
  2. memory.FreeMemory returns a non-zero uint64 available system RAM in bytes
  3. memory.FreeMemory returns an amount less than or equal to memory.TotalMemory
  4. memory.TotalMemory returns consistent byte counts across consecutive calls

Dateien

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Quellartefakt herunterladen (tar.gz)

Quelltext

PROMPT.md
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/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58

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.
csx.json
{"case":{"caseId":"case:sha256:ecb41f038e56fe3cf40fff40e14609e02112a83edfde11e0fb9b8350cf22fb5d","contract":["memory.TotalMemory returns a non-zero uint64 total system RAM in bytes","memory.FreeMemory returns a non-zero uint64 available system RAM in bytes","memory.FreeMemory returns an amount less than or equal to memory.TotalMemory","memory.TotalMemory returns consistent byte counts across consecutive calls"],"goal":"verify pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58","kind":"HOW","packages":["pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58"],"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/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58"],"schemaVersion":1,"subject":"pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58","verifierAdapter":"golang@1"}
go.mod
module sample

go 1.26.6

require github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
go.sum
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
main.go
package main

import (
	"fmt"

	"github.com/pbnjay/memory"
)

func main() {
	total := memory.TotalMemory()
	free := memory.FreeMemory()

	fmt.Printf("Total system memory: %d bytes (%.2f GB)\n", total, float64(total)/(1024*1024*1024))
	fmt.Printf("Free system memory:  %d bytes (%.2f GB)\n", free, float64(free)/(1024*1024*1024))
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/pbnjay/memory@v0.0.0-20210728143218-7b4eea64cf58"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"github.com/pbnjay/memory"
)

func main() {
	if err := runContract(); err != nil {
		fmt.Fprintf(os.Stderr, "Contract verification failed: %v\n", err)
		os.Exit(1)
	}
	fmt.Println("All memory contract assertions passed successfully.")
}

func runContract() error {
	// Assertion 1: TotalMemory returns a non-zero positive byte count
	total := memory.TotalMemory()
	if total == 0 {
		return fmt.Errorf("expected TotalMemory() > 0, got %d", total)
	}

	// Assertion 2: FreeMemory returns a non-zero positive byte count
	free := memory.FreeMemory()
	if free == 0 {
		return fmt.Errorf("expected FreeMemory() > 0, got %d", free)
	}

	// Assertion 3: FreeMemory returns less than or equal to TotalMemory
	if free > total {
		return fmt.Errorf("expected FreeMemory() <= TotalMemory(), got free=%d, total=%d", free, total)
	}

	// Assertion 4: Consecutive calls to TotalMemory remain deterministic and consistent
	totalSecond := memory.TotalMemory()
	if total != totalSecond {
		return fmt.Errorf("expected consistent TotalMemory() across calls, got %d and %d", total, totalSecond)
	}

	return nil
}

Ursprungs-Seeder

anonym