mountlib: make Nodes also be fmt.Stringer so they debug nicely

This commit is contained in:
Nick Craig-Wood
2017-05-09 11:29:02 +01:00
parent 9c3048580a
commit abda616f84
5 changed files with 46 additions and 3 deletions

View File

@ -52,6 +52,17 @@ func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, e
return fh, nil
}
// String converts it to printable
func (fh *WriteFileHandle) String() string {
if fh == nil {
return "<nil *WriteFileHandle>"
}
if fh.file == nil {
return "<nil *WriteFileHandle.file>"
}
return fh.file.String() + " (w)"
}
// Node returns the Node assocuated with this - satisfies Noder interface
func (fh *WriteFileHandle) Node() Node {
return fh.file