Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
8b199273e8 | |
|
67df8f90f9 |
16
clone.go
16
clone.go
|
@ -68,7 +68,7 @@ func clone(gopath string) (*gitpb.Repo, error) {
|
||||||
gopath = CleanRepoURL(gopath)
|
gopath = CleanRepoURL(gopath)
|
||||||
os.Setenv("REPO_AUTO_CLONE", "true")
|
os.Setenv("REPO_AUTO_CLONE", "true")
|
||||||
// pb, _ := forge.NewGoPath(gopath)
|
// pb, _ := forge.NewGoPath(gopath)
|
||||||
check := forge.FindAnyPath(filepath.Join(forge.GetGoSrc(), gopath))
|
check := forge.FindAnyPath(filepath.Join(forge.Config.ReposDir, gopath))
|
||||||
if check != nil {
|
if check != nil {
|
||||||
if check.IsValidDir() {
|
if check.IsValidDir() {
|
||||||
// repo already exists and is valid
|
// repo already exists and is valid
|
||||||
|
@ -103,28 +103,28 @@ func recursiveClone(check *gitpb.Repo) error {
|
||||||
if check == nil {
|
if check == nil {
|
||||||
return errors.New("repo was nil")
|
return errors.New("repo was nil")
|
||||||
}
|
}
|
||||||
log.Info("STARTING RECURSIVE CLONE", check.GetGoPath())
|
log.Info("STARTING RECURSIVE CLONE", check.Namespace)
|
||||||
log.Info("STARTING RECURSIVE CLONE", check.GetGoPath())
|
log.Info("STARTING RECURSIVE CLONE", check.Namespace)
|
||||||
// if just cloned, parse the go.sum file for deps
|
// if just cloned, parse the go.sum file for deps
|
||||||
if check.ParseGoSum() {
|
if check.ParseGoSum() {
|
||||||
} else {
|
} else {
|
||||||
makeValidGoSum(check)
|
makeValidGoSum(check)
|
||||||
}
|
}
|
||||||
|
|
||||||
check.Reload()
|
check.ReloadForce()
|
||||||
|
|
||||||
if check.GoDeps == nil {
|
if check.GoDeps == nil {
|
||||||
log.Info("repo godeps == nil", check.GetGoPath())
|
log.Info("repo godeps == nil", check.Namespace)
|
||||||
return errors.New("no go deps?")
|
return errors.New("no go deps?")
|
||||||
}
|
}
|
||||||
|
|
||||||
// probably this should never be 0 because GoPrimitive should have been true otherwise
|
// probably this should never be 0 because GoPrimitive should have been true otherwise
|
||||||
if check.GoDeps.Len() == 0 {
|
if check.GoDeps.Len() == 0 {
|
||||||
log.Info("repo len(godeps) == 0", check.GetGoPath())
|
log.Info("repo len(godeps) == 0", check.Namespace)
|
||||||
return errors.New("go.sum never parsed?")
|
return errors.New("go.sum never parsed?")
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Info("deps for", check.GetGoPath(), "len()", check.GoDeps.Len())
|
log.Info("deps for", check.Namespace, "len()", check.GoDeps.Len())
|
||||||
deps := check.GoDeps.SortByGoPath()
|
deps := check.GoDeps.SortByGoPath()
|
||||||
for deps.Scan() {
|
for deps.Scan() {
|
||||||
depRepo := deps.Next()
|
depRepo := deps.Next()
|
||||||
|
@ -179,7 +179,7 @@ func makeValidGoSum(check *gitpb.Repo) error {
|
||||||
|
|
||||||
// if this fails, just use go mod
|
// if this fails, just use go mod
|
||||||
if err := check.ValidGoSum(); err != nil {
|
if err := check.ValidGoSum(); err != nil {
|
||||||
cmd := []string{"go", "mod", "init", check.GetGoPath()}
|
cmd := []string{"go", "mod", "init", check.Namespace}
|
||||||
log.Info("try running", cmd)
|
log.Info("try running", cmd)
|
||||||
if _, err := check.RunQuiet(cmd); err != nil {
|
if _, err := check.RunQuiet(cmd); err != nil {
|
||||||
log.Info("go mod init failed", err)
|
log.Info("go mod init failed", err)
|
||||||
|
|
2
main.go
2
main.go
|
@ -86,6 +86,6 @@ func okExit(thing string) {
|
||||||
|
|
||||||
func badExit(err error) {
|
func badExit(err error) {
|
||||||
log.Info("Total repositories:", forge.Repos.Len())
|
log.Info("Total repositories:", forge.Repos.Len())
|
||||||
log.Info("Finished go-clone with error", err, forge.GetGoSrc())
|
log.Info("Finished go-clone with error", err, forge.Config.ReposDir)
|
||||||
os.Exit(-1)
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
|
|
6
work.go
6
work.go
|
@ -10,10 +10,10 @@ func autoWork() {
|
||||||
if !argv.AutoWork {
|
if !argv.AutoWork {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("About to re-create", forge.GetGoSrc()+"/go.work")
|
log.Info("About to re-create", forge.Config.ReposDir+"/go.work")
|
||||||
shell.PathRun(forge.GetGoSrc(), []string{"mv", "go.work", "go.work.last"})
|
shell.PathRun(forge.Config.ReposDir, []string{"mv", "go.work", "go.work.last"})
|
||||||
forge.MakeGoWork()
|
forge.MakeGoWork()
|
||||||
shell.PathRun(forge.GetGoSrc(), []string{"go", "work", "use"})
|
shell.PathRun(forge.Config.ReposDir, []string{"go", "work", "use"})
|
||||||
log.Info("")
|
log.Info("")
|
||||||
log.Info("original go.work file saved as go.work.last")
|
log.Info("original go.work file saved as go.work.last")
|
||||||
log.Info("")
|
log.Info("")
|
||||||
|
|
Loading…
Reference in New Issue