diff --git a/cmd/cmd.go b/cmd/cmd.go index 8a2d5d24a..279bb84d3 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -83,5 +83,6 @@ func versionSuffix(value string) string { } func isSubpackage(rootPath, targetPath string) bool { - return strings.HasSuffix(workDir, rootPath) || strings.HasPrefix(rootPath, targetPath) + return strings.HasSuffix(strings.Replace(workDir, "\\", "/", -1), rootPath) || + strings.HasPrefix(rootPath, targetPath) } diff --git a/cmd/gen.go b/cmd/gen.go index 3b31516d4..5e067b7a8 100644 --- a/cmd/gen.go +++ b/cmd/gen.go @@ -62,8 +62,7 @@ func runGen(ctx *cli.Context) { for _, p := range imports { p = doc.GetProjectPath(p) // Skip subpackage(s) of current project. - if strings.HasSuffix(strings.Replace(workDir, "\\", "/", -1), p) || - strings.HasPrefix(p, targetPath) { + if isSubpackage(p, targetPath) { continue }