1
0
mirror of https://github.com/beego/bee.git synced 2024-11-25 20:10:55 +00:00

Merge pull request #367 from gloomyzerg/master

fix #332 swagger generate bug on windows
This commit is contained in:
Sergey Lanzman 2017-03-12 17:24:20 +02:00 committed by GitHub
commit b3ea5dda0e
2 changed files with 9 additions and 1 deletions

2
bee.go
View File

@ -160,7 +160,7 @@ func main() {
// Check if current directory is inside the GOPATH, // Check if current directory is inside the GOPATH,
// if so parse the packages inside it. // if so parse the packages inside it.
if strings.Contains(currentpath, GetGOPATHs()[0]+"/src") && isGenerateDocs(cmd.Name(), args) { if IsInGOPATH(currentpath) && isGenerateDocs(cmd.Name(), args) {
parsePackagesFromDir(currentpath) parsePackagesFromDir(currentpath)
} }

View File

@ -68,6 +68,14 @@ func GetGOPATHs() []string {
return paths return paths
} }
// IsInGOPATH checks the path is in the fisrt GOPATH(/src) or not
func IsInGOPATH(thePath string) bool {
if runtime.GOOS == "windows" {
thePath = filepath.ToSlash(thePath)
}
return strings.Contains(thePath, GetGOPATHs()[0]+"/src")
}
// IsBeegoProject checks whether the current path is a Beego application or not // IsBeegoProject checks whether the current path is a Beego application or not
func IsBeegoProject(thePath string) bool { func IsBeegoProject(thePath string) bool {
mainFiles := []string{} mainFiles := []string{}