Skip to content

Commit d613bc8

Browse files
committed
Update checks for files or dirs existing
The previous way is considered outdated now.
1 parent 2914480 commit d613bc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go/extractor/util/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func DepErrors(pkgpath string, flags ...string) bool {
183183
// FileExists tests whether the file at `filename` exists and is not a directory.
184184
func FileExists(filename string) bool {
185185
info, err := os.Stat(filename)
186-
if err != nil && !os.IsNotExist(err) {
186+
if err != nil && !errors.Is(err, fs.ErrNotExist) {
187187
log.Printf("Unable to stat %s: %s\n", filename, err.Error())
188188
}
189189
return err == nil && !info.IsDir()
@@ -192,7 +192,7 @@ func FileExists(filename string) bool {
192192
// DirExists tests whether `filename` exists and is a directory.
193193
func DirExists(filename string) bool {
194194
info, err := os.Stat(filename)
195-
if err != nil && !os.IsNotExist(err) {
195+
if err != nil && !errors.Is(err, fs.ErrNotExist) {
196196
log.Printf("Unable to stat %s: %s\n", filename, err.Error())
197197
}
198198
return err == nil && info.IsDir()

0 commit comments

Comments
 (0)