From 384d46897be464b05bd50cb36315675556e103cb Mon Sep 17 00:00:00 2001 From: Joseph Edwards Van Riper III Date: Tue, 12 Feb 2019 08:23:17 -0500 Subject: [PATCH] Fix for projects with 'tests' in path Projects with the string 'tests' in their path cannot document their models properly in swaggergen. The comment says the 'tests' subfolder within the dirpath should be excluded, but the test was for the full path. This should fix the discrepancy. --- generate/swaggergen/g_docs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate/swaggergen/g_docs.go b/generate/swaggergen/g_docs.go index e24656d..2ef09d2 100644 --- a/generate/swaggergen/g_docs.go +++ b/generate/swaggergen/g_docs.go @@ -119,7 +119,7 @@ func ParsePackagesFromDir(dirpath string) { // all 'tests' folders and dot folders wihin dirpath d, _ := filepath.Rel(dirpath, fpath) if !(d == "vendor" || strings.HasPrefix(d, "vendor"+string(os.PathSeparator))) && - !strings.Contains(fpath, "tests") && + !strings.Contains(d, "tests") && !(d[0] == '.') { err = parsePackageFromDir(fpath) if err != nil {