daemon_windows.go
func GetExecutablePath() (string, error) {
	buf := make([]uint16, syscall.MAX_PATH+1)

	res, _, err := getModuleFileName.Call(0, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
	if res == 0 || res >= syscall.MAX_PATH || buf[0] == 0 || buf[res-1] == 0 {
		return "", fmt.Errorf("GetModuleFileNameW returned %d errno=%d", res, err)
	}

	return string(utf16.Decode(buf[:res])), nil
}
func GetExecutablePath() (string, error) {
	buf := make([]uint16, syscall.MAX_PATH+1)

	res, _, err := getModuleFileName.Call(0, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
	if res == 0 || res >= syscall.MAX_PATH || buf[0] == 0 || buf[res-1] == 0 {
		return "", fmt.Errorf("GetModuleFileNameW returned %d errno=%d", res, err)
	}

	return string(utf16.Decode(buf[:res])), nil
}
// GetExecutablePath returns the absolute path to the currently running
// executable.  It is used internally by the godaemon package, and exported
// publicly because it's useful outside of the package too.