Beispiel
github.com/prometheus/procfs v0.7.3: DefaultMountPoint
Verifiziertes Beispiel für golang github.com/prometheus/procfs v0.7.3: DefaultMountPoint. Der Vertrag lief auf go 1.26 · linux alpine/x64 · docker und…
sha256:e02d4395518fec935b1a9904c964bec4d0f04845bd913186c4acbb686fbc6729
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
go linux 24 · ubuntu · glibc 2.39 x64 go go 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@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-27 |
Fall
HOW- Ziel
- verify github.com/prometheus/procfs.DefaultMountPoint in pkg:golang/github.com/prometheus/procfs@v0.7.3
- Symbole
-
- github.com/prometheus/procfs.DefaultMountPoint
- Umgebung
- go
- Erstellt
- 2026-08-27T15:53:19Z
Contract
- procfs.DefaultMountPoint defines the standard Linux proc filesystem mount path as "/proc".
- procfs.NewFS initializes an FS interface rooted at procfs.DefaultMountPoint to inspect process and system metrics.
- procfs.NewDefaultFS creates an FS instance using the DefaultMountPoint path.
- procfs.NewFS validates the specified path and returns an error when given a non-existent directory or regular file.
Dateien
- NOTES.md
- PROMPT.md
- csx.json
- go.mod
- go.sum
- procfs_test.go
- spec.json
Quelltext
# prometheus/procfs DefaultMountPoint Verification Notes
## Search Results
An initial search via `search_known_solution` for `pkg:golang/github.com/prometheus/procfs@v0.7.3` with `github.com/prometheus/procfs.DefaultMountPoint` returned reference-only match for v0.12.0.
## Pinned Version
- Package: `github.com/prometheus/procfs`
- Release: `v0.7.3` (in `go.mod` / `go.sum`)
## Observed Behavior
1. **DefaultMountPoint Constant**:
- `procfs.DefaultMountPoint` is the default mount point string constant `"/proc"`.
2. **Mount Initialization**:
- `procfs.NewFS(procfs.DefaultMountPoint)` initializes a pseudo-filesystem interface rooted at `/proc`, allowing access to process information via `fs.Self()` and system stats via `fs.Stat()`.
- `procfs.NewDefaultFS()` initializes an identical `FS` rooted at `procfs.DefaultMountPoint`.
3. **Mount Point Validation**:
- Initializing `procfs.NewFS` with a non-existent path or a non-directory regular file returns an error.
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 github.com/prometheus/procfs.DefaultMountPoint in pkg:golang/github.com/prometheus/procfs@v0.7.3
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/prometheus/procfs@v0.7.3
Demonstrate these symbols/APIs:
- github.com/prometheus/procfs.DefaultMountPoint
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:f751bf3ef884438591c1c4f23bff558f5c2fd5c429314e8b79d429b33394917c","contract":["procfs.DefaultMountPoint defines the standard Linux proc filesystem mount path as \"/proc\".","procfs.NewFS initializes an FS interface rooted at procfs.DefaultMountPoint to inspect process and system metrics.","procfs.NewDefaultFS creates an FS instance using the DefaultMountPoint path.","procfs.NewFS validates the specified path and returns an error when given a non-existent directory or regular file."],"goal":"verify github.com/prometheus/procfs.DefaultMountPoint in pkg:golang/github.com/prometheus/procfs@v0.7.3","kind":"HOW","packages":["pkg:golang/github.com/prometheus/procfs@v0.7.3"],"schemaVersion":1,"symbols":["github.com/prometheus/procfs.DefaultMountPoint"]},"contractCommand":["go","test","./..."],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","executionContext":"go","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","runtime":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/prometheus/procfs@v0.7.3"],"schemaVersion":1,"subject":"pkg:golang/github.com/prometheus/procfs@v0.7.3","symbols":["github.com/prometheus/procfs.DefaultMountPoint"],"verifierAdapter":"golang@1"}
module example.com/procfssample
go 1.20
require github.com/prometheus/procfs v0.7.3
require golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
package procfssample_test
import (
"os"
"path/filepath"
"testing"
"github.com/prometheus/procfs"
)
func TestDefaultMountPointValue(t *testing.T) {
// Verify DefaultMountPoint is "/proc"
if procfs.DefaultMountPoint != "/proc" {
t.Fatalf("expected procfs.DefaultMountPoint to be %q, got %q", "/proc", procfs.DefaultMountPoint)
}
}
func TestNewFSWithDefaultMountPoint(t *testing.T) {
// Initialize FS explicitly with DefaultMountPoint
fs, err := procfs.NewFS(procfs.DefaultMountPoint)
if err != nil {
t.Fatalf("unexpected error initializing procfs with DefaultMountPoint (%s): %v", procfs.DefaultMountPoint, err)
}
// Verify accessing /proc/self returns the current process
selfProc, err := fs.Self()
if err != nil {
t.Fatalf("failed to retrieve current process via fs.Self(): %v", err)
}
if selfProc.PID != os.Getpid() {
t.Errorf("expected self proc PID %d, got %d", os.Getpid(), selfProc.PID)
}
// Verify reading /proc/stat
stat, err := fs.Stat()
if err != nil {
t.Fatalf("failed to read procfs stat: %v", err)
}
if stat.BootTime == 0 {
t.Errorf("expected non-zero boot time in procfs stat")
}
}
func TestNewDefaultFSMatchesDefaultMountPoint(t *testing.T) {
// NewDefaultFS returns an FS mounted at DefaultMountPoint
defaultFS, err := procfs.NewDefaultFS()
if err != nil {
t.Fatalf("unexpected error from NewDefaultFS(): %v", err)
}
explicitFS, err := procfs.NewFS(procfs.DefaultMountPoint)
if err != nil {
t.Fatalf("unexpected error from NewFS(DefaultMountPoint): %v", err)
}
// Both should query the same self process PID
proc1, err1 := defaultFS.Self()
proc2, err2 := explicitFS.Self()
if err1 != nil || err2 != nil {
t.Fatalf("errors querying Self(): err1=%v, err2=%v", err1, err2)
}
if proc1.PID != proc2.PID || proc1.PID != os.Getpid() {
t.Errorf("expected matching PID %d, got proc1=%d, proc2=%d", os.Getpid(), proc1.PID, proc2.PID)
}
}
func TestNewFSWithInvalidMountPoint(t *testing.T) {
// Initializing procfs with a non-existent directory returns an error
invalidPath := "/nonexistent/procfs/path"
_, err := procfs.NewFS(invalidPath)
if err == nil {
t.Fatalf("expected error when initializing procfs with non-existent mountpoint %q, got nil", invalidPath)
}
// Initializing procfs with a regular file (not a directory) returns an error
tmpFile := filepath.Join(t.TempDir(), "not_a_dir")
if err := os.WriteFile(tmpFile, []byte("test"), 0644); err != nil {
t.Fatalf("failed to create temp file: %v", err)
}
_, err = procfs.NewFS(tmpFile)
if err == nil {
t.Fatalf("expected error when initializing procfs with regular file %q, got nil", tmpFile)
}
}
{
"schemaVersion": 1,
"goal": "verify github.com/prometheus/procfs.DefaultMountPoint in pkg:golang/github.com/prometheus/procfs@v0.7.3",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/prometheus/procfs@v0.7.3"
],
"symbols": [
"github.com/prometheus/procfs.DefaultMountPoint"
]
}
Ursprungs-Seeder
anonym