1
0
mirror of https://github.com/rclone/rclone.git synced 2026-01-04 09:33:36 +00:00

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

@@ -46,6 +46,17 @@ func newReadFileHandle(f *File, o fs.Object) (*ReadFileHandle, error) {
return fh, nil
}
// String converts it to printable
func (fh *ReadFileHandle) String() string {
if fh == nil {
return "<nil *ReadFileHandle>"
}
if fh.file == nil {
return "<nil *ReadFileHandle.file>"
}
return fh.file.String() + " (r)"
}
// Node returns the Node assocuated with this - satisfies Noder interface
func (fh *ReadFileHandle) Node() Node {
return fh.file