summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.go11
-rw-r--r--goDebCheck.go36
-rw-r--r--goSrcScan.go34
-rw-r--r--human.go2
-rw-r--r--repoNew.go2
-rw-r--r--repoSettings.go15
6 files changed, 88 insertions, 12 deletions
diff --git a/build.go b/build.go
index 697f558..0b8b58a 100644
--- a/build.go
+++ b/build.go
@@ -91,12 +91,17 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
}
log.Info("running:", cmd)
- if r := repo.RunRealtime(cmd); r.Error == nil {
- // log.Warn("go build worked")
+ result := repo.RunRealtime(cmd)
+ if result.Exit == 0 {
+ log.Info(strings.Join(result.Stdout, "\n"))
return nil
} else {
+ log.DaemonMode(true)
+ log.Info(strings.Join(result.Stdout, "\n"))
+ log.Info(strings.Join(result.Stderr, "\n"))
+ log.DaemonMode(false)
log.Warn("go build failed", cmd)
- return errors.New("go build failed: " + fmt.Sprint(r.Error))
+ return errors.New("go build failed: " + fmt.Sprint(result.Error))
}
}
diff --git a/goDebCheck.go b/goDebCheck.go
index 793397f..f5e11e7 100644
--- a/goDebCheck.go
+++ b/goDebCheck.go
@@ -1,6 +1,8 @@
package forgepb
import (
+ "strings"
+
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -20,7 +22,7 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
}
// clear out the protobuf and rescan from the file
check.GoDeps = nil
- if ok, err := check.ParseGoSum(); ! ok {
+ if ok, err := check.ParseGoSum(); !ok {
log.Info("FinalGoDepsCheckOk() error", err)
return false
}
@@ -37,18 +39,42 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
depRepo := deps.Next()
found := f.Repos.FindByGoPath(depRepo.GetGoPath())
if found == nil {
+ if f.checkOverride(depRepo.GetGoPath()) {
+ // skip this gopath because it's probably broken forever
+ continue
+ }
log.Info("not found:", depRepo.GetGoPath())
- return false
+ good = false
+ continue
}
// log.Info("found dep", depRepo.GetGoPath())
if depRepo.GetVersion() != found.GetTargetVersion() {
- if f.IsReadOnly(depRepo.GetGoPath()) {
+ check := f.Repos.FindByGoPath(depRepo.GoPath)
+ if f.IsReadOnly(check) {
log.Printf("%-48s ok error %10s vs %10s (ignoring read-only repo)", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
} else {
- log.Printf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
- good = false
+ if f.checkOverride(depRepo.GetGoPath()) {
+ log.Printf("%-48s ok error %10s vs %10s (forge.checkOverride())", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
+ // skip this gopath because it's probably broken forever
+ continue
+ } else {
+ log.Printf("%-48s error %10s vs %10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetMasterVersion())
+ good = false
+ }
}
}
}
return good
}
+
+func (f *Forge) checkOverride(gopath string) bool {
+ if gopath == "cloud.google.com/go" {
+ log.Info("checkOverride() is ignoring", gopath)
+ return false
+ }
+ if strings.HasPrefix(gopath, "github.com/go-gl") {
+ log.Info("checkOverride() is ignoring", gopath)
+ return false
+ }
+ return false
+}
diff --git a/goSrcScan.go b/goSrcScan.go
index 2287149..9aedd85 100644
--- a/goSrcScan.go
+++ b/goSrcScan.go
@@ -155,3 +155,37 @@ func (f *Forge) rillScanDirs(gopaths []string) (int, error) {
return counter, err
}
+
+func (f *Forge) RillRedoGoMod() int {
+ var all []*gitpb.Repo
+ repos := f.Repos.SortByGoPath()
+ for repos.Scan() {
+ repo := repos.Next()
+ if !repo.IsValid() {
+ log.Printf("%10s %-50s", "old?", repo.GetGoPath())
+ continue
+ }
+ all = append(all, repo)
+ }
+ // Convert a slice of user IDs into a channel
+ ids := rill.FromSlice(all, nil)
+
+ var counter int
+ // Read users from the API.
+ // Concurrency = 20
+ dirs := rill.Map(ids, 50, func(id *gitpb.Repo) (*gitpb.Repo, error) {
+ return id, nil
+ })
+
+ err := rill.ForEach(dirs, 20, func(repo *gitpb.Repo) error {
+ counter += 1
+ repo.RedoGoMod()
+ return nil
+ })
+
+ if err != nil {
+ log.Info("rill.ForEach() error:", err)
+ }
+
+ return counter
+}
diff --git a/human.go b/human.go
index 7033985..6685b48 100644
--- a/human.go
+++ b/human.go
@@ -29,7 +29,7 @@ func (f *Forge) standardHeader(r *ForgeConfig) string {
if f.IsFavorite(r.GoPath) {
flags += "(favorite) "
}
- if f.IsReadOnly(r.GoPath) {
+ if f.Config.IsReadOnly(r.GoPath) {
readonly = ""
} else {
readonly = "r/w"
diff --git a/repoNew.go b/repoNew.go
index 1e6c7d4..209f807 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -38,7 +38,7 @@ func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) {
}
}
- if f.IsReadOnly(newr.GoPath) {
+ if f.Config.IsReadOnly(newr.GoPath) {
return
}
diff --git a/repoSettings.go b/repoSettings.go
index 66677f8..128d1a1 100644
--- a/repoSettings.go
+++ b/repoSettings.go
@@ -12,6 +12,8 @@ package forgepb
import (
"path/filepath"
"strings"
+
+ "go.wit.com/lib/protobuf/gitpb"
)
/*
@@ -36,10 +38,19 @@ func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool {
// returns true if gopath is readonly()
// will attempt to match IsWritable("foo") against anything ending in "foo"
-func (f *Forge) IsReadOnly(gopath string) bool {
+func (f *Forge) IsReadOnly(repo *gitpb.Repo) bool {
+ // var match *ForgeConfig
+
+ return f.Config.IsReadOnly(repo.GoPath)
+}
+
+// returns true if gopath is readonly()
+// will attempt to match IsWritable("foo") against anything ending in "foo"
+func (f *ForgeConfigs) IsReadOnly(gopath string) bool {
var match *ForgeConfig
- loop := f.Config.SortByGoPath() // get the list of repos
+
+ loop := f.SortByGoPath() // get the list of repos
for loop.Scan() {
r := loop.Next()
if r.GoPath == gopath {