diff options
| author | Jeff Carr <[email protected]> | 2024-03-09 09:23:41 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-03-09 09:23:41 -0600 |
| commit | 4dbfd68272d1753562fd25e384148bcdf47f6218 (patch) | |
| tree | 00d69df31c04329ec06a0b2863d8e761056885fd /common.go | |
| parent | a048e33f587a8883f8a4f71d27c5dedb6b0afc6c (diff) | |
pull down missing go deps
Diffstat (limited to 'common.go')
| -rw-r--r-- | common.go | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -1,6 +1,10 @@ package repolist import ( + "fmt" + "os" + "path/filepath" + "go.wit.com/gui" "go.wit.com/lib/gui/repostatus" "go.wit.com/log" @@ -172,3 +176,34 @@ func (rl *RepoList) TotalGo() int { } return count } + +// very much a hack job +func (rl *RepoList) MakeGoWork() error { + goSrcDir := os.Getenv("REPO_WORK_PATH") + filename := filepath.Join(goSrcDir, "go.work") + + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600) + if err != nil { + return err + } + defer f.Close() + + fmt.Fprintln(f, "go 1.21.4") // fix this + fmt.Fprintln(f, "") + fmt.Fprintln(f, "use (") + for _, repo := range rl.allrepos { + if repo.Status.GoPath() == "" { + // skip repos that aren't go + // todo: handle non-flat repos? + continue + } + if repo.Status.Exists("go.mod") { + fmt.Fprintln(f, "\t"+repo.Status.GoPath()) + } else { + log.Info("missing go.mod for", repo.Status.Path()) + repo.Status.MakeRedomod() + } + } + fmt.Fprintln(f, ")") + return nil +} |
