From 5d0dd06d1ce1829b0399cf8fa0570970273401a6 Mon Sep 17 00:00:00 2001 From: Kieran Colford Date: Wed, 25 Oct 2017 11:31:58 -0400 Subject: [PATCH] windows: document panics in LazyProc Some of LazyProc's methods will panic if the procedure cannot be found. This patch documents that fact. Change-Id: If446a61e001ae04eaba0ff08b512df4def8a00b7 Reviewed-on: https://go-review.googlesource.com/73450 Reviewed-by: Ian Lance Taylor Reviewed-by: Alex Brainman --- windows/dll_windows.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/windows/dll_windows.go b/windows/dll_windows.go index d177227e..b9940f16 100644 --- a/windows/dll_windows.go +++ b/windows/dll_windows.go @@ -289,6 +289,7 @@ func (p *LazyProc) mustFind() { // Addr returns the address of the procedure represented by p. // The return value can be passed to Syscall to run the procedure. +// It will panic if the procedure cannot be found. func (p *LazyProc) Addr() uintptr { p.mustFind() return p.proc.Addr() @@ -297,7 +298,7 @@ func (p *LazyProc) Addr() uintptr { //go:uintptrescapes // Call executes procedure p with arguments a. It will panic, if more then 15 arguments -// are supplied. +// are supplied. It will also panic if the procedure cannot be found. // // The returned error is always non-nil, constructed from the result of GetLastError. // Callers must inspect the primary return value to decide whether an error occurred