Merge pull request #454 from scf2k/fixscan

Fix: docs generator skips everything containing 'vendor'
This commit is contained in:
astaxie 2017-07-19 00:29:40 +08:00 committed by GitHub
commit 899aede629
1 changed files with 5 additions and 1 deletions

View File

@ -104,7 +104,11 @@ func ParsePackagesFromDir(dirpath string) {
return nil
}
if !strings.Contains(fpath, "vendor") && !strings.Contains(fpath, "tests") {
// 7 is length of 'vendor' (6) + length of file path separator (1)
// so we skip dir 'vendor' which is directly under dirpath
if !(len(fpath) == len(dirpath)+7 && strings.HasSuffix(fpath, "vendor")) &&
!strings.Contains(fpath, "tests") &&
!(len(fpath) > len(dirpath) && fpath[len(dirpath)+1] == '.') {
err = parsePackageFromDir(fpath)
if err != nil {
// Send the error to through the channel and continue walking