{"id":38633052,"url":"https://github.com/zperf/bpftrace-formatter","last_synced_at":"2026-01-17T09:01:32.486Z","repository":{"id":310293282,"uuid":"1039357789","full_name":"zperf/bpftrace-formatter","owner":"zperf","description":"bpftrace script file formatter","archived":false,"fork":false,"pushed_at":"2025-08-17T04:09:34.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-17T05:27:45.768Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zperf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-17T03:32:36.000Z","updated_at":"2025-08-17T04:09:38.000Z","dependencies_parsed_at":"2025-08-17T05:27:46.244Z","dependency_job_id":null,"html_url":"https://github.com/zperf/bpftrace-formatter","commit_stats":null,"previous_names":["zperf/bpftrace-formatter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zperf/bpftrace-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zperf%2Fbpftrace-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zperf%2Fbpftrace-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zperf%2Fbpftrace-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zperf%2Fbpftrace-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zperf","download_url":"https://codeload.github.com/zperf/bpftrace-formatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zperf%2Fbpftrace-formatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-17T09:00:54.905Z","updated_at":"2026-01-17T09:01:31.756Z","avatar_url":"https://github.com/zperf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BPFTrace Formatter\n\nA Go tool for formatting bpftrace scripts.\n\n## Features\n\n- Automatic formatting of bpftrace probe definitions\n- Support for predicates formatting\n- Unified indentation and spacing\n- Preserve comments and shebang\n- Configurable formatting options\n\n## Installation\n\n```bash\ngo mod tidy\ngo build -o bpftrace-formatter\n```\n\n## Usage\n\n### Basic Usage\n\n```bash\n./bpftrace-formatter \u003cfile.bt\u003e\n```\n\n### Example\n\nInput file (`test_input.bt`):\n\n```bpftrace\n#!/usr/bin/env bpftrace\ntracepoint:syscalls:sys_enter_openat{printf(\"openat: %s\\n\",str(args.filename));}\ntracepoint:syscalls:sys_enter_openat2{printf(\"openat2: %s\\n\",str(args-\u003efilename));}\ntracepoint:syscalls:sys_enter_openat/pid==1234/{@opens[pid]=count();}\n```\n\nOutput:\n\n```bpftrace\n#!/usr/bin/env bpftrace\ntracepoint:syscalls:sys_enter_openat {\n    printf(\"openat: %s\\n\",str(args.filename));\n}\n\n\ntracepoint:syscalls:sys_enter_openat2 {\n    printf(\"openat2: %s\\n\",str(args-\u003efilename));\n}\n\n\ntracepoint:syscalls:sys_enter_openat/pid==1234/ {\n    @opens[pid]=count();\n}\n```\n\n## Configuration Options\n\nThe following options can be configured through code:\n\n- `SetIndentSize(int)`: Set indentation size (default: 4)\n- `SetUseSpaces(bool)`: Use spaces instead of tabs (default: true)\n- `SetProbeSpacing(int)`: Set number of empty lines between probes (default: 2)\n\n## Testing\n\n```bash\ngo test -v\n```\n\n## Project Structure\n\n- `main.go`: Main formatting logic\n- `main_test.go`: Unit tests\n- `example.bt`: Formatting example\n- `test_input.bt`: Test input file\n\n## Supported Syntax Features\n\n- Probe definitions (tracepoint, kprobe, uprobe, etc.)\n- Predicate filtering\n- Block statement formatting\n- Comment preservation\n- END block handling\n- Multi-line statement support\n\n## Limitations\n\n- Currently mainly handles single-line probe definitions\n- Complex multi-line blocks may need further optimization\n- Some special bpftrace syntax may not be fully supported\n\n## Development\n\nThis project is developed in Go. Contributions and issue reports are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzperf%2Fbpftrace-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzperf%2Fbpftrace-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzperf%2Fbpftrace-formatter/lists"}