if go mod tidy fails, the package is special
This commit is contained in:
parent
114c77907a
commit
891017f2f9
19
doStrict.go
19
doStrict.go
|
@ -8,6 +8,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func doStrict(repo *gitpb.Repo) error {
|
func doStrict(repo *gitpb.Repo) error {
|
||||||
|
var err error
|
||||||
|
|
||||||
if !repo.IsValidDir() {
|
if !repo.IsValidDir() {
|
||||||
log.Info(repo.GetGoPath(), "is invalid. fix your repos.pb file with 'forge' first")
|
log.Info(repo.GetGoPath(), "is invalid. fix your repos.pb file with 'forge' first")
|
||||||
log.Info("")
|
log.Info("")
|
||||||
|
@ -35,7 +37,7 @@ func doStrict(repo *gitpb.Repo) error {
|
||||||
return errors.New(repo.GetGoPath() + " not in the git master branch")
|
return errors.New(repo.GetGoPath() + " not in the git master branch")
|
||||||
}
|
}
|
||||||
|
|
||||||
err := repo.RepoIgnoresGoMod()
|
err = repo.RepoIgnoresGoMod()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info(repo.GetGoPath(), "some wierd git error happened. investigate.", err)
|
log.Info(repo.GetGoPath(), "some wierd git error happened. investigate.", err)
|
||||||
return err
|
return err
|
||||||
|
@ -57,11 +59,22 @@ func doStrict(repo *gitpb.Repo) error {
|
||||||
log.Info(repo.GetGoPath(), "GOING TO MAKE NEW go.* FILES")
|
log.Info(repo.GetGoPath(), "GOING TO MAKE NEW go.* FILES")
|
||||||
|
|
||||||
// actually will re-create go.sum and go.mod now
|
// actually will re-create go.sum and go.mod now
|
||||||
if err := redoGoMod(repo); err != nil {
|
if _, err = repo.RunQuiet([]string{"go", "mod", "init", repo.GetGoPath()}); err != nil {
|
||||||
log.Info(repo.GetGoPath(), "redoGoMod() failed", err)
|
log.Warn("go mod init failed", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if repo.Exists("go.mod") {
|
||||||
|
// well, if go mod init fails, then we will just error since 'go mod init' almost never fails
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := repo.RunQuiet([]string{"go", "mod", "tidy", "-go=" + golangVersion}); err == nil {
|
||||||
|
// I guess the thing to do, if go mod tidy fails, is to just leave the repo alone
|
||||||
|
// it's either primitive or could be a go support project but not in go
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// the first time, it'll attempt to fix some stuff
|
// the first time, it'll attempt to fix some stuff
|
||||||
cleanGoDepsCheckOk(repo)
|
cleanGoDepsCheckOk(repo)
|
||||||
// try to trim junk
|
// try to trim junk
|
||||||
|
|
Loading…
Reference in New Issue