Explorar el Código

refactor (#48)

* rebase upstream

* rebase

* trim no need line

* trim no need line

* trim no need line

* refactor gomod module logic

Co-authored-by: kingxt <dream4kingxt@163.com>
kingxt hace 4 años
padre
commit
2b815162f6
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      tools/goctl/util/project/project.go

+ 6 - 1
tools/goctl/util/project/project.go

@@ -87,7 +87,12 @@ func Prepare(projectDir string, checkGrpcEnv bool) (*Project, error) {
 		}
 
 		if !strings.HasPrefix(pwd, src) {
-			name = filepath.Clean(filepath.Base(projectDir))
+			absPath, err := filepath.Abs(projectDir)
+			if err != nil {
+				return nil, err
+			}
+
+			name = filepath.Clean(filepath.Base(absPath))
 			path = projectDir
 		} else {
 			r := strings.TrimPrefix(pwd, src+string(filepath.Separator))