fix config yaml gen (#25)

* optimized

* format

Co-authored-by: kingxt <dream4kingxt@163.com>
This commit is contained in:
kingxt
2020-08-27 15:23:19 +08:00
committed by GitHub
parent a987d12237
commit 38806e7237
4 changed files with 65 additions and 50 deletions

View File

@@ -140,20 +140,7 @@ func createGoModFileIfNeed(dir string) {
panic(err)
}
var tempPath = absDir
var hasGoMod = false
for {
if util.FileExists(filepath.Join(tempPath, goModeIdentifier)) {
hasGoMod = true
break
}
tempPath = filepath.Dir(tempPath)
if tempPath == filepath.Dir(tempPath) {
break
}
}
_, hasGoMod := util.FindGoModPath(dir)
if !hasGoMod {
gopath := os.Getenv("GOPATH")
parent := path.Join(gopath, "src")