summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go1
-rw-r--r--clone.go29
2 files changed, 27 insertions, 3 deletions
diff --git a/argv.go b/argv.go
index 057f967..f2abb8b 100644
--- a/argv.go
+++ b/argv.go
@@ -16,6 +16,7 @@ type args struct {
Pull bool `arg:"--git-pull" default:"false" help:"run 'git pull'"`
Build bool `arg:"--build" default:"true" help:"try to build it after clone"`
Install bool `arg:"--install" default:"false" help:"try to install it after clone"`
+ Ignore bool `arg:"--ignore" default:"false" help:"ignore weird clone errors from non-standard repos"`
// Fetch bool `arg:"--git-fetch" default:"false" help:"run 'git fetch' on all your repos"`
}
diff --git a/clone.go b/clone.go
index 4c1a1ac..91edf62 100644
--- a/clone.go
+++ b/clone.go
@@ -2,6 +2,7 @@ package main
import (
"errors"
+ "fmt"
"os"
"path/filepath"
@@ -99,15 +100,27 @@ func recursiveClone(check *gitpb.Repo) error {
}
log.Info("got", good, "repos", "failed on", bad, "repos")
if bad != 0 {
+ log.Info("clone() ERROR len(badmap)", len(badmap))
for gopath, err := range badmap {
- log.Info("clone() error", gopath, err)
+ log.Info("clone() ERROR", gopath, err)
+ }
+ if !argv.Ignore {
+ return errors.New("clone failed on some repos")
}
- return errors.New("clone failed on some repos")
}
return nil
}
func makeValidGoSum(check *gitpb.Repo) error {
+ if check.Exists("go.mod") {
+ if err := check.SetPrimitive(); err != nil {
+ return err
+ }
+ }
+ if check.GoPrimitive {
+ log.Info(check.GoPath, "is a golang primitive! no need to parse go.sum because there is not one!")
+ return nil
+ }
// first try to generate go.mod & go.sum with go-mod-clean
if err := check.ValidGoSum(); err != nil {
log.Info("try running go-mod-clean")
@@ -126,14 +139,24 @@ func makeValidGoSum(check *gitpb.Repo) error {
if err := check.RunStrict(cmd); err != nil {
log.Info("go mod init failed", err)
}
+ if check.Exists("go.mod") {
+ if err := check.SetPrimitive(); err != nil {
+ return err
+ }
+ }
+ if check.GoPrimitive {
+ log.Info(check.GoPath, "is a golang primitive! no need to parse go.sum because there is not one!")
+ return nil
+ }
if err := check.RunStrict([]string{"go", "mod", "tidy"}); err != nil {
log.Info("go mod tidy failed", err)
}
+ panic("fucknuts")
}
if err := check.ValidGoSum(); err != nil {
// have to give up. can't recursive clone without go.mod file
log.Info("could not generate valid go.sum file")
- return err
+ return errors.New(fmt.Sprintf("could have been %v", err))
}
check.ParseGoSum()
return nil