summaryrefslogtreecommitdiff
path: root/doPublish.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-30 19:16:16 -0500
committerJeff Carr <[email protected]>2025-10-30 19:16:16 -0500
commitdafb9c7028762f0c86499fc3fa557132064d37ec (patch)
treeac80ba738dc48006def47921802e504e89ff6bfd /doPublish.go
parent53654740343a08b0df7027e144323750a9960eb7 (diff)
wrong git syntax. more work on publishing
Diffstat (limited to 'doPublish.go')
-rw-r--r--doPublish.go43
1 files changed, 29 insertions, 14 deletions
diff --git a/doPublish.go b/doPublish.go
index faf17b3..4a3e9a3 100644
--- a/doPublish.go
+++ b/doPublish.go
@@ -23,20 +23,22 @@ func rillRestore(repo *gitpb.Repo) error {
return nil
}
+ cmd := []string{"go-mod-clean", "lax"}
+ if env.True("--strict") {
+ cmd = []string{"go-mod-clean", "purge"}
+ repo.RunQuiet(cmd)
+ cmd = []string{"go-mod-clean", "--restore"}
+ }
+
var err error
- if argv.Verbose {
- log.Info("go-mod-clean lax START", repo.GetGoPath())
- result := repo.RunRealtime([]string{"go-mod-clean", "lax"})
- log.Info("go-mod-clean lax END", repo.GetGoPath())
- if result.Exit != 0 {
- err = fmt.Errorf("repo %s failed %d", repo.GetGoPath(), result.Exit)
- }
+ if env.Verbose() {
+ _, err = repo.RunQuiet(cmd)
} else {
- _, err = repo.RunQuiet([]string{"go-mod-clean", "lax"})
+ _, err = repo.RunQuiet(cmd)
}
if err != nil {
- log.Info("go-mod-clean lax failed", repo.GetGoPath(), err)
- return err
+ errs := fmt.Sprintf("%v failed (%v)", cmd, err)
+ return errors.New(errs)
}
return nil
}
@@ -45,13 +47,26 @@ func doPublish() error {
initForge()
env.PrintTable()
- me.forge.RillFuncError(rillRestore)
+ log.Printf("Running go-mod-clean on (%d) repos. (1 second per hundred)\n", me.forge.Repos.Len())
+ restored := me.forge.RunOnReposNew(me.forge.Repos, rillRestore)
+ restored = restored.SortActual()
+ footer := restored.PrintPublishNewTB()
+ fmt.Printf("restored.len(%d) with errors: %s\n", restored.Len(), footer)
// publish := me.forge.RunOnReposNewDumb(me.forge.Repos, rePrepareReleaseNew) // doesn't use Rill()
publish := me.forge.RunOnReposNew(me.forge.Repos, rePrepareReleaseNew)
if publish == nil {
return errors.New("nothing to publish. you actually have to write code first")
}
+ for repo := range publish.IterAll() {
+ err := me.forge.CheckUpdatingGoDeps(repo.GoDeps, publish)
+ if err != nil {
+ repo.State = fmt.Sprintf("%s err (%v)\n", repo.Namespace, err)
+ } else {
+ cmd := []string{"go-mod-clean", "strict"}
+ repo.RunRealtime(cmd)
+ }
+ }
for repo := range publish.IterAll() {
// update the target version
@@ -60,7 +75,7 @@ func doPublish() error {
}
publish = publish.SortActual()
- footer := publish.PrintPublishNewTB()
+ footer = publish.PrintPublishNewTB()
fmt.Printf("publish.len(%d) PrintPublishTable() footer: %s\n", publish.Len(), footer)
tryme := findNext(publish)
@@ -75,8 +90,8 @@ func doPublish() error {
releaseReason := "new attempt"
- for i, repo := range tryme {
- log.Info("tryme:", i, repo.FullPath)
+ for _, repo := range tryme {
+ log.Printf("tryme: %s reason(%s)", repo.FullPath, repo.State)
gomod, err := os.ReadFile(filepath.Join(repo.FullPath, "go.mod"))
if err != nil {
panic("go.mod missing")