weaveworks / tcptracer-bpf

eBPF program using kprobes to trace TCP events without run-time compilation dependencies
Apache License 2.0
410 stars 61 forks source link

Adding missing linux header #60

Closed mcgourty closed 5 years ago

mcgourty commented 6 years ago

tcptracer-bpf is missing a linux header in event.go that blocks development on non-linux machines. Adding this is desirable so that repositories using tcptracer-bpf can be tested (though not integration tested) on non-linux machines.

bboreham commented 6 years ago

Should the file be renamed to event_linux.go ?

mcgourty commented 6 years ago

@bboreham is that a convention? other linux files in the repo aren't named that way, but it sounds like a good idea for clarity

bboreham commented 6 years ago

It's a convention supported by go build.

If a file's name, after stripping the extension and a possible _test suffix, matches any of the following patterns: *_GOOS *_GOARCH *_GOOS_GOARCH (example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).

I don't have much background knowledge for this repo as a whole; it's just a thought that struck me.

bboreham commented 5 years ago

I see that tracer.go has the build constraint you've added to event.go, so I'll just merge this. Thanks!