-
Having to commit generated binary files to a repository is a bit troubling. I realise that I wonder if the alternative model with bpf object files being generated on the fly is supported. Can I find an example somewhere? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I remember discussing this at some point, but I can't seem to find where. Essentially, bpf2go is written with the assumption that you will check in the .o and the .go. If you don't want to do that I'd say you shouldn't commit either file: the |
Beta Was this translation helpful? Give feedback.
-
I have figured the bits and pieces. Please let me know if the setup below can be improved.
This is a simple eBPF-enabled tool to play with the setup (
As
If someone attempts to build or run Finally, here's my //go:build bpf
package main
import (
_ "github.com/cilium/ebpf"
)
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -makebase $BPF2GO_MAKEBASE -tags bpf Dp bpf/xdp.c
func main() {
} The tool should only be built via Makefile, therefore
Finally, I use Could we maybe make |
Beta Was this translation helpful? Give feedback.
I have figured the bits and pieces. Please let me know if the setup below can be improved.
This is a simple eBPF-enabled tool to play with the setup (
./cmd/test
). I don't want to ever commit generated files, therefore there are a bunch of lines in.gitignore
:As
go build
won't invokebpf2go
on its own, I have a wrapperMakefile
.