You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- `func Load() (ok bool, err error)` to ease the integration in
dd-trace-go so that we can distinguish the different possible error
cases:
- Panic errors that must be used to gracefully abort the caller and
prevent it from continuing. Such errors are represented by the new
`PanicError` error type.
- Unsupported target OS and/or architecture, which must be handled as an
informative error, is worth logging to the user, and prevents the caller
from continuing. This error is represented by the new
`UnsupportedTarget` error type.
- Every other unexpected error that can possible happen is returned
as-is, but `ok` is `false`, so that the caller knows it cannot use the
package.
- Informative errors, about internal non-critical failures, can also
happen (eg. if os.Remove fails removing the temporary files), and are
returned as-is, but with `ok` being `true` so that the caller can log
the error and continue its startup.
- The dd-trace-go integration of this PR can be found here
DataDog/dd-trace-go#2090
- Note that `Health()` has been kept for the sake of simplicity
health-checking cases such as in the tests, where it returns the
`Load()` error only if `ok` is false, meaning that go-libddwaf is not
healthy.
- Simplified build tags, removed everywhere it was possible, down to
purego which isn't properly stubbed for unsupported targets and which we
stub ourselves at our level in the new `waf_dl_unsupported.go` file.
---------
Co-authored-by: Eliott Bouhana <[email protected]>
Co-authored-by: François Mazeau <[email protected]>
0 commit comments