Explorar o código

fix: root path on windows bug (#34)

* rebase upstream

* rebase

* trim no need line

* trim no need line

* trim no need line

* fix bug on windows

Co-authored-by: kingxt <dream4kingxt@163.com>
kingxt %!s(int64=4) %!d(string=hai) anos
pai
achega
33eb2936e8
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      tools/goctl/util/path.go

+ 1 - 1
tools/goctl/util/path.go

@@ -61,7 +61,7 @@ func FindGoModPath(dir string) (string, bool) {
 	for {
 		if FileExists(filepath.Join(tempPath, goModeIdentifier)) {
 			tempPath = filepath.Dir(tempPath)
-			rootPath = absDir[len(tempPath)+1:]
+			rootPath = strings.TrimPrefix(absDir[len(tempPath):], "/")
 			hasGoMod = true
 			break
 		}