On Tuesday, 16 November 2021 at 14:49:54 UTC leam...@gmail.com wrote:
> For the errors in lines 14-19, what other failures do you see needing to
> be handled?
IMO, programs should handle *all* errors - especially the ones you don't
anticipate.
But if the filesystem is starting to return EIO
I would go for something more like: https://play.golang.org/p/MyorlUwOL9s
and not bother with the intermediate checks, just read directly and report
any issues you encounter
On Tuesday, November 16, 2021 at 3:49:54 PM UTC+1 leam...@gmail.com wrote:
> Brian, thanks! Here's the playground link:
Brian, thanks! Here's the playground link:
https://play.golang.org/p/Ef8D4CF-kKD
For the errors in lines 14-19, what other failures do you see needing to be handled? I'm
still not comprehending how to check for "isReadable()", but that would be a
useful next step. Of course, when the file is
(BTW, sharing your code on play.golang.org makes it easier to format and
read)
On Tuesday, 16 November 2021 at 14:11:54 UTC leam...@gmail.com wrote:
>
> 14 func exists(filepath string) bool {
> 15 if _, err := os.Stat(filepath); errors.Is(err, fs.ErrNotExist) {
> 16 return false
> 17 }
> 18