cmd.NewFsSrc([]string{"/path/to/file") is sending error "is a file not a directory"

Hey!

Thanks for that wonderful library!
I’m trying to cat the content of a file and to do so I’m creating a fs.Fs with cmd.NewFsSrc([]string{"/path/to/file") but that func return the error “/path/to/file is a file not a directory”

The comment of that function is:
// NewFsSrc creates a new src fs from the arguments.
//
// The source can be a file or a directory - if a file then it will
// limit the Fs to a single file.

What am I doing wrong there?
Many thanks!

What happens is if you get fs.ErrorIsFile you can still use the returned fs but it points to the parent directory the file is in.

Ok many thanks! I just figured that I was badly using it.
Again, great library!

1 Like