// NewELF returns a new object from the specified reader.
//
// The ELF binary is expected to start at position 0 in the specified reader.
548790
func NewELF(ra io.ReaderAt, scopedLog *logrus.Entry) (*ELF, error) {
	ef, err := elf.NewFile(ra)
	if err != nil {
		return nil, fmt.Errorf("unable to open ELF: %s", err)
	}

	// EM_NONE is generated by older Clang (eg 3.8.x), which we currently
	// use in Travis. We should be able to drop that part pretty soon.
	if ef.Machine != elf.EM_NONE && ef.Machine != elf.EM_BPF {
		return nil, fmt.Errorf("unsupported ELF machine type %s", ef.Machine)
	}

	result := &ELF{
		metadata: ef,
		log:      scopedLog,
	}
	if err := result.symbols.extractFrom(ef); err != nil {
		return nil, fmt.Errorf("unable to read ELF symbols: %s", err)
	}

	return result, nil
}
144411
func NewParser(r io.Reader, err func(Error) bool) Parser {
	return &parser{_lexer: NewLexer(r), _error: err}
}
479871
func NewReader(r io.ReaderAt, size int64) (*Reader, error) {
	zr := new(Reader)
	if err := zr.init(r, size); err != nil {
		return nil, err
	}
	return zr, nil
}
412770
func NewReader(r io.Reader, limiter Limiter) io.Reader {
	return &reader{r, limiter}
}
590819
func NewEnumTypeDef(init ...*EnumTypeDef) *EnumTypeDef {
	var o *EnumTypeDef
	if len(init) == 1 {
		o = init[0]
	} else {
		o = new(EnumTypeDef)
	}
	return o.Init()
}
367859
func NewReader(config ReaderConfig) (*Reader, error) {
	if err := config.validate(); err != nil {
		return nil, errors.Trace(err)
	}
	r := &Reader{config: config}
	return r, nil
}
886215
func Newf(format string, a ...interface{}) Goof {
	return WithError(fmt.Sprintf(format, a), nil)
}
49970
func NewNativeReader(r io.Reader) Reader {
	return &reader{
		r:  r,
		bo: NativeEndian,
	}
}
252507
func NewLexer(rd io.Reader) *Lexer {
	p := Lexer{}
	p.rd = rd
	p.lastByte = bufSize
	p.buf = make([]byte, bufSize)
	p.r = -1
	p.fill()
	return &p
}
100850
func NewLexer(r io.Reader) Lexer {
	return &lexer{_r: bufio.NewReader(r), _line: 1, _column: 1}
}
550441
func NewReader(in io.Reader) (*Reader, error) {
	r := new(Reader)
	r.r.source = in
	r.r.seeker, _ = in.(io.Seeker)
	if err := r.init(); err != nil {
		return nil, err
	}
	return r, nil
}
925321
func NewFromReader(r io.Reader) (*Json, error) {
	j := new(Json)
	dec := json.NewDecoder(r)
	dec.UseNumber()
	err := dec.Decode(&j.data)
	return j, err
}
299137
func NewFromReader(r io.Reader) storage.Store {
	d := util.NewJSONDecoder(r)
	var data map[string]interface{}
	if err := d.Decode(&data); err != nil {
		panic(err)
	}
	return NewFromObject(data)
}
689902
func NewReader(r io.Reader) (*Reader, error) {
	ar := &Reader{r: r}
	arHeader := make([]byte, arHeaderSize)
	_, err := io.ReadFull(ar.r, arHeader)
	if err != nil {
		return nil, err
	}
	if string(arHeader) != ArFileHeader {
		return nil, errors.New("ar: Invalid ar file")
	}
	return ar, nil
}
536657
func NewReader(r io.Reader, limit int64) *Reader {
	return &Reader{r, New(0, 0), limit, true}
}
413980
func (k *Kontrol) InitializeSelf() error {
	if len(k.lastPublic) == 0 && len(k.lastPrivate) == 0 {
		return errors.New("Please initialize AddKeyPair() method")
	}

	key, err := k.registerUser(k.Kite.Config.Username, k.lastPublic[0], k.lastPrivate[0])
	if err != nil {
		return err
	}
	return kitekey.Write(key)
}
542461
func NewLexer(r io.Reader) *Lexer {
	var b []byte
	if r != nil {
		if buffer, ok := r.(interface {
			Bytes() []byte
		}); ok {
			b = buffer.Bytes()
		} else {
			var err error
			b, err = ioutil.ReadAll(r)
			if err != nil {
				return &Lexer{
					buf: []byte{0},
					err: err,
				}
			}
		}
	}
	return NewLexerBytes(b)
}