Closed as not planned
Description
go version go1.11.2 linux/amd64
I'm writing some Go code that is called by C code, and I find there's no obvious way to map an error value to a Unix errno value. For example, at one point I write:
n, err := conn.WriteToUDP(data, &addr)
if err != nil {
e := unix.EIO
if os.IsTimeout(err) {
e = unix.EAGAIN
}
C.set_errno(e)
return -1
}
While that keeps the code working, it obviously loses a lot of the error granularity. Given that the errno value must be available somewhere under the hood, it's infuriating that it's not exported.
(I'd envision for example an interface with a single method ToOsInteger
and that is implemented for those errors for which it makes sense to map to a Unix errno.)