// wrapSyscallError takes an error and a syscall name. If the error is // a syscall.Errno, it wraps it in an os.SyscallError using the syscall name. func wrapSyscallError(name string, err error) error { … } // tryLimitedReader tries to assert the io.Reader to io.LimitedReader, it returns the io.LimitedReader, // the underlying io.Reader and the remaining amount of bytes if the assertion succeeds, // otherwise it just returns the original io.Reader and the theoretical unlimited remaining amount of bytes. func tryLimitedReader(r io.Reader) (*io.LimitedReader, io.Reader, int64) { … }