Linux command
gobee 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Translate
gobee translate --bindings-dir [./bpf] [./bpf/src]
Install
go install github.com/boratanrikulu/gobee/cmd/gobee@latest
Diagnose
gobee diagnose [verifier.log]
说明
gobee is a pure-Go transpiler that converts a strict subset of Go into BPF (Berkeley Packet Filter) C source code, together with typed Go bindings for the resulting programs. It targets developers who want to author eBPF programs without writing C directly, while keeping the resulting object compatible with libbpf and clang's BPF backend. The primary subcommand, translate, reads Go source files describing BPF programs and produces three artifacts in the target directory: a .bpf.c file, a sourcemap (.bpf.c.map) used for error attribution, and **\*_bindings.go files exposing typed loaders and program handles. clang with BPF target support is required to compile the generated C into an object file; gobee itself only depends on Go. The tool also exposes typed stubs for the libbpf v1.5.0 helper set, performs kernel-version gating with bpfvet**, and can map verifier errors back to the original Go positions for offline debugging.
参数
- translate
- Transpile Go BPF sources to C and generate Go bindings.
- diagnose
- Map verifier output back to source positions using the generated sourcemap.
- --bindings-dir _dir_
- Output directory for the generated Go bindings.
FAQ
What is the gobee command used for?
gobee is a pure-Go transpiler that converts a strict subset of Go into BPF (Berkeley Packet Filter) C source code, together with typed Go bindings for the resulting programs. It targets developers who want to author eBPF programs without writing C directly, while keeping the resulting object compatible with libbpf and clang's BPF backend. The primary subcommand, translate, reads Go source files describing BPF programs and produces three artifacts in the target directory: a .bpf.c file, a sourcemap (.bpf.c.map) used for error attribution, and **\*_bindings.go files exposing typed loaders and program handles. clang with BPF target support is required to compile the generated C into an object file; gobee itself only depends on Go. The tool also exposes typed stubs for the libbpf v1.5.0 helper set, performs kernel-version gating with bpfvet**, and can map verifier errors back to the original Go positions for offline debugging.
How do I run a basic gobee example?
Run `gobee translate --bindings-dir [./bpf] [./bpf/src]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does translate do in gobee?
Transpile Go BPF sources to C and generate Go bindings.