From 296d2d5fd31d1ea8f210ddd2443bc7e7ba8f12a9 Mon Sep 17 00:00:00 2001 From: Sauyon Lee Date: Fri, 29 May 2020 03:41:03 -0700 Subject: [PATCH] extractor: modify FileExists to check that the path isn't a directory --- extractor/util/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extractor/util/util.go b/extractor/util/util.go index a3c85788c6b..21a7d4ef25c 100644 --- a/extractor/util/util.go +++ b/extractor/util/util.go @@ -85,9 +85,9 @@ func GetPkgDir(pkgpath string) string { // FileExists tests whether the file at `filename` exists. func FileExists(filename string) bool { - _, err := os.Stat(filename) + info, err := os.Stat(filename) if err != nil && !os.IsNotExist(err) { log.Printf("Unable to stat %s: %s\n", filename, err.Error()) } - return err == nil + return err == nil && !info.IsDir() }