-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid using syscall for errors on unix #201
base: master
Are you sure you want to change the base?
Conversation
//go:build !unix | ||
// +build !unix | ||
|
||
package fsutil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if these should live in an internal package, as (I think) we don't want consumers to be using these to match against (they're only do prevent having to split out the implementation further, correct?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of returning typed errors if we don't want consumers to match against them?
I don't really see an issue with old code as well, but if we define these separately, then we should export them as well to let consumers know what they can match against.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@catap There are some conflicts, can you rebase?
syscall is deprecated and non updated library whcih should be replaced by new one with name x/sys. Anyway, it may work on some platform and some errors migth be missed on some. A good example is OpenBSD which has lack of syscall.EBADMSG on amd64 and 386 but has on arm64. Here I moved all errors to two files: one for unix which uses sys.unix, and one for everything else which uses syscall as fallback.
@crazy-max here it is. I haven't tried to build it on go-1.22 but conflict was trivial and grep by patterns |
actually we could just play with build tags for this instead
syscall is deprecated and non updated library whcih should be replaced by new one with name x/sys.
Anyway, it may work on some platform and some errors migth be missed on some. A good example is OpenBSD which has lack of syscall.EBADMSG on amd64 and 386 but has on arm64.
Here I moved all errors to two files: one for unix which uses sys.unix, and one for everything else which uses syscall as fallback.