sort go.work file
This commit is contained in:
parent
4dbfd68272
commit
06904e1158
16
common.go
16
common.go
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
|
@ -191,7 +192,16 @@ func (rl *RepoList) MakeGoWork() error {
|
|||
fmt.Fprintln(f, "go 1.21.4") // fix this
|
||||
fmt.Fprintln(f, "")
|
||||
fmt.Fprintln(f, "use (")
|
||||
for _, repo := range rl.allrepos {
|
||||
|
||||
keys := make([]string, 0, len(rl.allrepos))
|
||||
|
||||
for k := range rl.allrepos {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
|
||||
for _, k := range keys {
|
||||
repo := rl.allrepos[k]
|
||||
if repo.Status.GoPath() == "" {
|
||||
// skip repos that aren't go
|
||||
// todo: handle non-flat repos?
|
||||
|
@ -200,8 +210,8 @@ func (rl *RepoList) MakeGoWork() error {
|
|||
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()
|
||||
log.Log(REPO, "missing go.mod for", repo.Status.Path())
|
||||
// repo.Status.MakeRedomod()
|
||||
}
|
||||
}
|
||||
fmt.Fprintln(f, ")")
|
||||
|
|
Loading…
Reference in New Issue