diff options
Diffstat (limited to 'libgo/go/syscall/syscall_js.go')
-rw-r--r-- | libgo/go/syscall/syscall_js.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libgo/go/syscall/syscall_js.go b/libgo/go/syscall/syscall_js.go index 175fe47fcaa..dfb4a275e30 100644 --- a/libgo/go/syscall/syscall_js.go +++ b/libgo/go/syscall/syscall_js.go @@ -44,6 +44,12 @@ const PathMax = 256 // if errno != 0 { // err = errno // } +// +// Errno values can be tested against error values from the os package +// using errors.Is. For example: +// +// _, _, err := syscall.Syscall(...) +// if errors.Is(err, os.ErrNotExist) ... type Errno uintptr func (e Errno) Error() string { @@ -297,9 +303,10 @@ func Getegid() int { return jsProcess.Call("getegid").Int() } -func Getgroups() ([]int, error) { +func Getgroups() (groups []int, err error) { + defer recoverErr(&err) array := jsProcess.Call("getgroups") - groups := make([]int, array.Length()) + groups = make([]int, array.Length()) for i := range groups { groups[i] = array.Index(i).Int() } |