From 33eb2936e812c82099b870dd01b18c9a74282596 Mon Sep 17 00:00:00 2001 From: kingxt Date: Wed, 2 Sep 2020 15:14:27 +0800 Subject: [PATCH] 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 --- tools/goctl/util/path.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/goctl/util/path.go b/tools/goctl/util/path.go index 55520b2c..d0f32f80 100644 --- a/tools/goctl/util/path.go +++ b/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 }