// ReadFile works the same as ioutil.ReadFile with the Driver abstraction
429766
func ReadFile(r Driver, filename string) ([]byte, error) {
	f, err := r.Open(filename)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	data, err := ioutil.ReadAll(f)
	if err != nil {
		return nil, err
	}

	return data, nil
}
184716
func sysReadFile(file string) ([]byte, error) {
	f, err := os.Open(file)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	// On some machines, hwmon drivers are broken and return EAGAIN.  This causes
	// Go's ioutil.ReadFile implementation to poll forever.
	//
	// Since we either want to read data or bail immediately, do the simplest
	// possible read using syscall directly.
	b := make([]byte, 128)
	n, err := syscall.Read(int(f.Fd()), b)
	if err != nil {
		return nil, err
	}

	return b[:n], nil
}
529889
func ReadFile(path string, offset uint64) *master.Call {
	return &master.Call{
		Type: master.Call_READ_FILE,
		ReadFile: &master.Call_ReadFile{
			Path:   path,
			Offset: offset,
		},
	}
}
766456
func (f *FakeFS) ReadFile(name string) ([]byte, error) {
	buf, ok := f.Files[name]
	if !ok {
		return nil, FakeFileNotFound{Filename: name}
	}
	return buf.Bytes(), nil
}
882538
func loadFile(path string, overload bool) error {
	env, err := ReadFile(path)
	if err != nil {
		return err
	}
	LoadMap(env, overload)
	return nil
}
808081
func ReadDataFile(path string) []byte {
	p, err := filepath.Abs(path)
	CheckError(err)

	data, ferr := ioutil.ReadFile(p)
	CheckError(ferr)

	return data
}
864765
func (b *binary) ReadFile(path ...string) ([]byte, error) {
	flatPath := b.Path(path...)
	return ioutil.ReadFile(flatPath)
}
803576
func ReadFile(ctx context.Context, fs FileSystem, path string) ([]byte, error) {
	rc, err := fs.Open(ctx, path)
	if err != nil {
		return nil, err
	}
	defer rc.Close()
	return ioutil.ReadAll(rc)
}
202248
func (r *realFS) ReadFile(name string) ([]byte, error) {
	return ioutil.ReadFile(name)
}
482997
func (p *GSPath) ReadFile() ([]byte, error) {
	var b bytes.Buffer
	done, err := RetryWithBackoff(gcsReadBackoff, func() (bool, error) {
		b.Reset()
		_, err := p.WriteTo(&b)
		if err != nil {
			if os.IsNotExist(err) {
				// Not recoverable
				return true, err
			}
			return false, err
		}
		// Success!
		return true, nil
	})
	if err != nil {
		return nil, err
	} else if done {
		return b.Bytes(), nil
	} else {
		// Shouldn't happen - we always return a non-nil error with false
		return nil, wait.ErrWaitTimeout
	}
}
745618
func ReadIgnoreFile(dir string) ([]byte, error) {
	path := filepath.Join(dir, ".apexignore")

	b, err := ioutil.ReadFile(path)

	if os.IsNotExist(err) {
		return nil, nil
	}

	if err != nil {
		return nil, err
	}

	return b, nil
}
1022218
func (fs *errorFS) ReadFile(
	ctx context.Context,
	op *fuseops.ReadFileOp) (err error) {
	if fs.transformError(op, &err) {
		return
	}

	if op.Inode != fooInodeID || op.Offset != 0 {
		err = fmt.Errorf("Unexpected request: %#v", op)
		return
	}

	op.BytesRead = copy(op.Dst, FooContents)

	return
}
440784
func ReadPidFile(name string) (pid int, err error) {
	var file *os.File
	if file, err = os.OpenFile(name, os.O_RDONLY, 0640); err != nil {
		return
	}
	defer file.Close()

	lock := &LockFile{file}
	pid, err = lock.ReadPid()
	return
}
1165217
func ReadConfigFromFile(path string) (*Config, error) {
	buffer, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}

	return ReadConfig(buffer)
}
948612
func (ns *Namespace) ReadFile(i interface{}) (string, error) {
	s, err := cast.ToStringE(i)
	if err != nil {
		return "", err
	}

	return readFile(ns.readFileFs, s)
}
278066
func (c *ConfigParser) ReadFile(path string) (err error) {
	f, err := os.Open(path)
	if err != nil {
		return err
	}
	return c.Read(f)
}
740567
func (h OsHelperImpl) ReadFile(filename string) (string, error) {
	b, err := ioutil.ReadFile(filename)
	if err != nil {
		return "", err
	}
	return string(b[:]), nil
}