You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: loader_darwin.go
    path of file: ./repos/sliver/implant/vendor/github.com/Binject/universal
    
    the code of the file until where you have to start completion: package universal

import (
	"bytes"
	"errors"
	"fmt"
	"unsafe"

	"github.com/Binject/debug/macho"
	"github.com/awgh/cppgo/asmcall/cdecl"
	"github.com/awgh/rawreader"
	"golang.org/x/sys/unix"
)

const MaxUint = ^uint(0)
const MaxInt = int
    
func findMachoPtr(addr uintptr) (uintptr, error) {
	var (
		base   uintptr
		header uint32
		err    error = fmt.Errorf("could not find macho")
	)
	idx := addr
	ptr := uintptr(*(*uint64)(unsafe.Pointer(idx)))
	for {
		if isPtrValid(ptr) {
			header = *(*uint32)(unsafe.Pointer(ptr))
			if header == macho.Magic64 {
				base = ptr
				err = nil
				break
			}
		}
		idx += 8
		ptr = uintptr(*(*uint64)(unsafe.Pointer(idx)))
	}
	return base, err
}