1
0
镜像自地址 https://github.com/beego/bee.git 已同步 2025-07-17 18:22:17 +00:00

Merge pull request #390 from ogero/develop

Fix generate swagger model api doc on Windows.
这个提交包含在:
astaxie
2017-03-24 22:35:15 +08:00
提交者 GitHub
当前提交 abf3c41032
共有 2 个文件被更改,包括 8 次插入4 次删除

查看文件

@@ -17,7 +17,6 @@ import (
"flag"
"log"
"os"
"strings"
"github.com/beego/bee/cmd"
"github.com/beego/bee/cmd/commands"
@@ -64,7 +63,7 @@ func main() {
// Check if current directory is inside the GOPATH,
// if so parse the packages inside it.
if strings.Contains(currentpath, utils.GetGOPATHs()[0]+"/src") && cmd.IfGenerateDocs(c.Name(), args) {
if utils.IsInGOPATH(currentpath) && cmd.IfGenerateDocs(c.Name(), args) {
swaggergen.ParsePackagesFromDir(currentpath)
}

查看文件

@@ -61,12 +61,17 @@ func GetGOPATHs() []string {
return paths
}
// IsInGOPATH checks the path is in the fisrt GOPATH(/src) or not
// IsInGOPATH checks whether the path is inside of any GOPATH or not
func IsInGOPATH(thePath string) bool {
if runtime.GOOS == "windows" {
thePath = filepath.ToSlash(thePath)
}
return strings.Contains(thePath, GetGOPATHs()[0]+"/src")
for _, gopath := range GetGOPATHs() {
if strings.Contains(thePath, gopath + "/src") {
return true
}
}
return false
}
// IsBeegoProject checks whether the current path is a Beego application or not