1
0
mirror of https://github.com/golang/go synced 2024-11-23 10:50:09 -07:00

syscall: let errors.ErrUnsupported match ERROR_NOT_SUPPORTED and ERROR_CALL_NOT_IMPLEMENTED

These error codes are returned on windows in case a particular functions
is not supported.

Updates #41198

Change-Id: Ic31755a131d4e7c96961ba54f5bb51026fc7a563
Reviewed-on: https://go-review.googlesource.com/c/go/+/476916
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Tobias Klauser 2023-03-16 19:23:34 +01:00 committed by Gopher Robot
parent 23e8f43cb1
commit 964985362b

View File

@ -142,7 +142,11 @@ func (e Errno) Error() string {
return string(utf16.Decode(b[:n]))
}
const _ERROR_BAD_NETPATH = Errno(53)
const (
_ERROR_NOT_SUPPORTED = Errno(50)
_ERROR_BAD_NETPATH = Errno(53)
_ERROR_CALL_NOT_IMPLEMENTED = Errno(120)
)
func (e Errno) Is(target error) bool {
switch target {
@ -162,7 +166,9 @@ func (e Errno) Is(target error) bool {
e == ERROR_PATH_NOT_FOUND ||
e == ENOENT
case errorspkg.ErrUnsupported:
return e == ENOSYS ||
return e == _ERROR_NOT_SUPPORTED ||
e == _ERROR_CALL_NOT_IMPLEMENTED ||
e == ENOSYS ||
e == ENOTSUP ||
e == EOPNOTSUPP ||
e == EWINDOWS