diff options
| author | Jeff Carr <[email protected]> | 2024-12-15 15:51:27 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-15 15:51:27 -0600 | 
| commit | 882c448b85ebf738cb1ab3803115c0701b809d90 (patch) | |
| tree | c69acef37e7c1bbe6d7473b82dac27b81e80bfb0 | |
| parent | bab2506d348a634ad35f81a09675c9beed493d2b (diff) | |
add --ignore for edge cases to see what happensv0.6.29
| -rw-r--r-- | argv.go | 1 | ||||
| -rw-r--r-- | clone.go | 29 | 
2 files changed, 27 insertions, 3 deletions
@@ -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"`  } @@ -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  | 
