Przeglądaj źródła

fix windows bug

kingxt 4 lat temu
rodzic
commit
fd75f700a2
1 zmienionych plików z 3 dodań i 0 usunięć
  1. 3 0
      tools/goctl/api/gogen/util.go

+ 3 - 0
tools/goctl/api/gogen/util.go

@@ -28,6 +28,9 @@ func getParentPackage(dir string) (string, error) {
 	var tempPath = absDir
 	var hasGoMod = false
 	for {
+		if tempPath == filepath.Dir(tempPath) {
+			break
+		}
 		tempPath = filepath.Dir(tempPath)
 		if goctlutil.FileExists(filepath.Join(tempPath, goModeIdentifier)) {
 			tempPath = filepath.Dir(tempPath)