KevinMGranger / go9p

Automatically exported from code.google.com/p/go9p
Other
0 stars 0 forks source link

clnt doesn't implement reader interface #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, nice job.

I think that it wouuld be nice if the clnt api would implement the io.Reader 
interface for File.

In particular I want to be able to use: ioutil.ReadAll(file)

The first thing I noticed is:

noce.go:36: cannot use file (type *clnt.File) as type io.Reader in function 
argument:
    *clnt.File does not implement io.Reader (wrong type for Read method)
        have Read(buf []uint8) (int, *p.Error)
        want Read(p []uint8) (n int, err os.Error)

I tried to fix the signatures:

-func (clnt *Clnt) Read(fid *Fid, offset uint64, count uint32) ([]byte, 
*p.Error) {
+func (clnt *Clnt) Read(fid *Fid, offset uint64, count uint32) ([]byte, 
os.Error) {
....

and it built fine. However at runtime the ioutil.ReadAll(file) didn't return.

I suspect that the is some difference w.r.t the io.Reader interface in way EOF 
is signaled.

Original issue reported on code.google.com by mmikuli...@gmail.com on 31 May 2011 at 9:30

GoogleCodeExporter commented 9 years ago
Fixed.

Original comment by lion...@gmail.com on 1 Jun 2011 at 8:25