use yaml, and detect go.mod in current dir

This commit is contained in:
kevin
2020-08-27 11:44:35 +08:00
parent 229544f3ca
commit 1c24e71568
4 changed files with 33 additions and 26 deletions

View File

@@ -143,15 +143,17 @@ func createGoModFileIfNeed(dir string) {
var tempPath = absDir
var hasGoMod = false
for {
if tempPath == filepath.Dir(tempPath) {
break
}
tempPath = filepath.Dir(tempPath)
if util.FileExists(filepath.Join(tempPath, goModeIdentifier)) {
hasGoMod = true
break
}
tempPath = filepath.Dir(tempPath)
if tempPath == filepath.Dir(tempPath) {
break
}
}
if !hasGoMod {
gopath := os.Getenv("GOPATH")
parent := path.Join(gopath, "src")