diff --git a/globalBuildOptions.go b/globalBuildOptions.go index ccf6b0b..8257da6 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -3,6 +3,7 @@ package main import ( "os" + "path/filepath" "go.wit.com/log" @@ -93,6 +94,17 @@ func globalBuildOptions(box *gui.Node) { newBranch.SetText("jcarr") me.autoWorkingPwd = gadgets.NewOneLiner(grid, "working directory (pwd)") + me.userHomePwd = gadgets.NewOneLiner(grid, "user home") + me.goSrcPwd = gadgets.NewOneLiner(grid, "go src home") + + homeDir, err := os.UserHomeDir() + if err != nil { + log.Warn("Error getting home directory:", err) + homeDir = "/home/autotypist" + } + me.userHomePwd.SetText(homeDir) + srcDir := filepath.Join(homeDir, "go/src") + me.goSrcPwd.SetText(srcDir) group2 := vbox.NewGroup("Run in every git repository") me.stopOnErrors = group2.NewCheckbox("Stop on errors") diff --git a/listWindow.go b/listWindow.go index c883bd2..1819b96 100644 --- a/listWindow.go +++ b/listWindow.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "net/http" "os" + "path/filepath" "strings" "go.wit.com/gui" @@ -94,8 +95,12 @@ func (s *section) add(path string) { lw.Disable() log.Info("downloading", tmp.path.String(), "here") os.Setenv("GO111MODULE", "off") - fullpath := "/home/jcarr/go/src/go.wit.com/" - quickCmd(fullpath, []string{"go", "get", "-v", tmp.path.String()}) + + goSrcDir := me.goSrcPwd.String() + quickCmd(goSrcDir, []string{"go", "get", "-v", tmp.path.String()}) + + fullpath := filepath.Join(goSrcDir, tmp.path.String()) + quickCmd(fullpath, []string{"go", "get", "-v", "-u", "."}) lw.Enable() }) if repostatus.VerifyLocalGoRepo(path) { diff --git a/structs.go b/structs.go index 55493cf..3c6acf3 100644 --- a/structs.go +++ b/structs.go @@ -55,6 +55,12 @@ type autoType struct { // The current working directory autoWorkingPwd *gadgets.OneLiner + // what is being used as your home dir + userHomePwd *gadgets.OneLiner + + // what is being used as ~/go/src + goSrcPwd *gadgets.OneLiner + downloadEverythingButton *gui.Node // delete ~/go/src & ~/go/pkg buttons