netlink
netlink copied to clipboard
routeSubscribeAt should wrap the error it returns
routeSubscribeAt
returns 3 kinds of errors. 2 of them are encapsulated with fmt.Errorf
.
- https://github.com/vishvananda/netlink/blob/main/route_linux.go#L1664
- https://github.com/vishvananda/netlink/blob/main/route_linux.go#L1685
To facilitate the caller life it could be cool to use %w
verb instead of %v
in fmt.Errorf
call.
This way the caller can, for example, easily check for ENOBUFS
error:
if errors.Is(err, syscall.ENOBUFS) {
but this needs go1.13.
As this repo requires 1.12, this means we have to change this requirement to 1.13 (to avoid doing horrible things with build tags, as go1.12 is now more than 3 years old and no longer maintained by the go team.)
Is this change a no-go or do you accept a PR?
Note that v1.1.0 does not encapsulate routeSubscribeAt
error with fmt.Errorf
, so errors.Is(err, syscall.ENOBUFS)
works fine.