Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Commit

Permalink
check file is not a directory when returned as a file (#214)
Browse files Browse the repository at this point in the history
* check file is not a directory when returned as a file

* fix PR comments
  • Loading branch information
rickyshrestha authored and markbates committed Jun 28, 2019
1 parent e4f52d8 commit 0e984b9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions v2/jam/parser/finder.go
Expand Up @@ -3,14 +3,15 @@ package parser
import (
"fmt"
"go/build"
"os"
"path/filepath"
"strings"
"time"

"github.com/gobuffalo/packr/v2/plog"
"github.com/karrick/godirwalk"
"github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/errx"
"github.com/gobuffalo/packr/v2/internal/takeon/github.com/markbates/oncer"
"github.com/gobuffalo/packr/v2/plog"
"github.com/karrick/godirwalk"
)

type finder struct {
Expand All @@ -33,12 +34,22 @@ func (fd *finder) findAllGoFiles(dir string) ([]string, error) {
if ext != ".go" {
return nil
}
//check if path is a dir
fi, err := os.Stat(path)
if err != nil {
return nil
}

if fi.IsDir() {
return nil
}

names = append(names, path)
return nil
}
err = godirwalk.Walk(dir, &godirwalk.Options{
FollowSymbolicLinks: true,
Callback: callback,
FollowSymbolicLinks: true,
Callback: callback,
})
})

Expand Down

0 comments on commit 0e984b9

Please sign in to comment.