commands/files: Made ReaderFile take ReadClosers instead of trying to cast reader to Closer

This commit is contained in:
Matt Bell 2015-01-13 22:28:44 -08:00
parent a2b3402aa4
commit f8347f925c

View File

@ -6,7 +6,7 @@ import "io"
// ReaderFiles are never directories, and can be read from and closed.
type ReaderFile struct {
Filename string
Reader io.Reader
Reader io.ReadCloser
}
func (f *ReaderFile) IsDirectory() bool {
@ -26,9 +26,5 @@ func (f *ReaderFile) Read(p []byte) (int, error) {
}
func (f *ReaderFile) Close() error {
closer, ok := f.Reader.(io.Closer)
if !ok {
return nil
}
return closer.Close()
return f.Reader.Close()
}