On Mon, Oct 16, 2017 at 8:17 PM, bronze man <bronze1...@gmail.com> wrote: > > In the file /usr/local/go/src/syscall/dll_windows.go:300 > > Is there any use case to use the always non-nil error obj? > > That is a strange design.I think I need to write my version of LazyProc. > > I can write something like following to work around this: > > func IsSyscallErrorHappen(err error) bool{ > if err==nil{ > return false > } > errNo,ok:=err.(syscall.Errno) > if ok && errNo==0{ > return false > } > return true > }
I think this is probably a bug in syscall.(*Proc).Call. It returns the type error, and is mostly implement by calling syscall.Syscall which returns the type Errno. Assigning an Errno to an error will never give you a nil error. It should change to something like r1, r2, errno = syscall.Syscall(...) if errno != 0 { err = errno } return Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.