use os.UserHomeDir()

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-01 21:45:04 -05:00
parent efba612ad6
commit 8d55a8316a
1 changed files with 8 additions and 19 deletions

View File

@ -160,29 +160,18 @@ func downloadRepo(path string) bool {
log.Info("downloading", path, "here")
os.Setenv("GO111MODULE", "off")
// goSrcDir := me.goSrcPwd.String()
goSrcDir := "/home/jcarr/go/src"
err, ok, output := shell.RunCmd(goSrcDir, []string{"go", "get", "-v", path})
if !ok {
log.Info("go get failed")
log.Info("err =", err)
log.Info("output =", output)
return false
}
homeDir, _ := os.UserHomeDir()
goSrcDir := filepath.Join(homeDir, "go/src")
fullpath := filepath.Join(goSrcDir, path)
err, ok, output = shell.RunCmd(fullpath, []string{"go", "get", "-v", "-u", "."})
if !ok {
log.Info("go get depends failed")
cmd := []string{"go-clone", "--recursive", "--no-work", "--go-src", path}
err := shell.NewRun(goSrcDir, cmd)
if err != nil {
log.Info("go-clone failed")
log.Info("err =", err)
log.Info("output =", output)
// log.Info("output =", output)
return false
}
/*
if me.autoDryRun.Checked() {
return false
}
*/
log.Info("go-clone worked")
return true
}