// noeof is used after reads in situations where EOF signifies invalid
// formatting or corruption.
181730
func noeof(n int, err error) (int, error) {
	if err == io.EOF {
		return n, io.ErrUnexpectedEOF
	}
	return n, err
}
1343454
func Errorf(format string, v ...interface{}) {
	defaultLogger.output(sError, 0, fmt.Sprintf(format, v...))
}
342081
func Ohaif(format string, a ...interface{}) (int, error) {
	return fmt.Printf(fmt.Sprintf("==> %s", format), a...)
}
530141
func errorf(status int, format string, a ...interface{}) *protocolError {
	return withStatus(fmt.Errorf(format, a...), status)
}
1066505
func NOutOf(n int32, policies []*cb.SignaturePolicy) *cb.SignaturePolicy {
	return &cb.SignaturePolicy{
		Type: &cb.SignaturePolicy_NOutOf_{
			NOutOf: &cb.SignaturePolicy_NOutOf{
				N:     n,
				Rules: policies,
			},
		},
	}
}
1270067
func elemOf(value reflect.Value) reflect.Value {
	for value.Kind() == reflect.Ptr {
		value = value.Elem()
	}
	return value
}
92637
func Errorf(err error, msg string, format ...interface{}) error {
	return NestedError{
		NestedErr: err,
		Err:       fmt.Errorf(msg, format...),
	}
}
663878
func Errorf(format string, a ...interface{}) error {
	return errors.New(compile(Sprintf(format, a...)))
}
695132
func HasEOF(r io.ReaderAt) (bool, error) {
	type sizer interface {
		Size() int64
	}
	type stater interface {
		Stat() (os.FileInfo, error)
	}
	type lenSeeker interface {
		io.Seeker
		Len() int
	}
	var size int64
	switch r := r.(type) {
	case sizer:
		size = r.Size()
	case stater:
		fi, err := r.Stat()
		if err != nil {
			return false, err
		}
		size = fi.Size()
	case lenSeeker:
		var err error
		size, err = r.Seek(0, 1)
		if err != nil {
			return false, err
		}
		size += int64(r.Len())
	default:
		return false, ErrNoEnd
	}

	b := make([]byte, len(cramEOFmarker))
	_, err := r.ReadAt(b, size-int64(len(cramEOFmarker)))
	if err != nil {
		return false, err
	}
	return bytes.Equal(b, cramEOFmarker), nil
}
75645
func EOF(err error) bool {
	if err == io.EOF {
		return true
	}

	if strings.Contains(err.Error(), "closed") {
		return true
	}

	if strings.Contains(err.Error(), "reset by peer") {
		return true
	}

	return false
}
132672
func (logs *Logs) Allf(format string, v ...interface{}) {
	logs.allf(format, v...)
}
1019601
func oneof(target string, vals []interface{}) string {
	elems := make([]string, len(vals))
	for i, v := range vals {
		elems[i] = fmt.Sprintf("%s == %#v", target, v)
	}
	return strings.Join(elems, " || ")
}
1374798
func Errorf(status int, format string, v ...interface{}) (int, *ErrorResponse) {
	return Error(status, fmt.Sprintf(format, v...))
}
1028116
func Errorf(format string, a ...interface{}) Error {
	return WrapSkipping(fmt.Errorf(format, a...), 1)
}
1137288
func ValidateIsOneOf(choices ...interface{}) FieldValidatorFunc {
	return func(value interface{}) error {
		for _, choice := range choices {
			if ok, err := stringutil.RelaxedEqual(choice, value); err == nil && ok {
				return nil
			}
		}

		return fmt.Errorf("value must be one of: %+v", choices)
	}
}
486094
func (s *SimpleLogger) Errorf(format string, v ...interface{}) {
	if s.level <= core.LOG_ERR {
		s.ERR.Output(2, fmt.Sprintf(format, v...))
	}
	return
}
414899
func Errorf(f func(string, ...interface{})) Option {
	return func(c *Client) error {
		c.errf = f
		return nil
	}
}