From 58c97dc8dbfb7d05fdacbf3ef528499be672d350 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Sat, 7 Dec 2019 08:31:15 +0100 Subject: [PATCH] Check for err before trying to access the stat struct --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 2b8c8a2..5de6667 100644 --- a/main.go +++ b/main.go @@ -73,8 +73,8 @@ func readerFromArg(s string) (*Source, error) { } } - st, _ := os.Stat(s) - if len(s) == 0 || st.IsDir() { + st, err := os.Stat(s) + if len(s) == 0 || (err == nil && st.IsDir()) { for _, v := range readmeNames { r, err := os.Open(filepath.Join(s, v)) if err == nil {