샘플
github.com/prometheus/procfs v0.7.3: DefaultMountPoint
검증된 샘플 — golang github.com/prometheus/procfs v0.7.3: DefaultMountPoint. go 1.26 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다.
sha256:e02d4395518fec935b1a9904c964bec4d0f04845bd913186c4acbb686fbc6729
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
go linux 24 · ubuntu · glibc 2.39 x64 go go go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 |
케이스
HOW- 목표
- verify github.com/prometheus/procfs.DefaultMountPoint in pkg:golang/github.com/prometheus/procfs@v0.7.3
- 심벌
-
- github.com/prometheus/procfs.DefaultMountPoint
- 환경
- go
- 생성일
- 2026-08-27T15:53:19Z
컨트랙트
- 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.
파일
- NOTES.md
- PROMPT.md
- csx.json
- go.mod
- go.sum
- procfs_test.go
- spec.json
소스
# 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"
]
}
오리진 시더
익명