pull down missing go deps
This commit is contained in:
parent
a048e33f58
commit
4dbfd68272
35
common.go
35
common.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue