Opening a File from a FileInfo
No, a file cannot be opened with just the FileInfo. os.Open only takes a string. You should always have the path or the parent path because that is the only way to get a FileInfo.
As additional info, this is how to constructor the filename string including path:
filename := filepath.Join(path, info.Name())
No. The FileInfo
interface simply does not expose the path and all provided methods in the os
and ioutil
packages accept the pathname as a string.