still trying to perfect this. todo: make gitpb perfect

This commit is contained in:
Jeff Carr 2024-12-15 15:52:46 -06:00
parent e3608b784e
commit a31f675e12
2 changed files with 21 additions and 4 deletions

View File

@ -133,6 +133,20 @@ func (f *Forge) finishClone(gopath string, giturl string) (*gitpb.Repo, error) {
log.Warn("forge.Clone() url changed", newr.URL, "to", giturl)
newr.URL = giturl
}
if err := newr.RepoIgnoresGoMod(); err != nil {
log.Info("never modify go.mod or go.sum for this repo", newr.GoPath)
log.Info("We recommend you add 'go.*' to your .gitignore file and store those files as git tag metadata")
newr.ParseGoSum()
return newr, nil
}
if newr.Exists("go.mod") {
return newr, nil
}
log.Info("todo: something went wrong probably. didn't finish. run go-mod-clean? (can't here. loop of circles)")
log.Info("todo: do go mod init here directly")
log.Info("todo: try to run go mod init here", newr.GoPath)
return newr, nil
}

View File

@ -27,13 +27,16 @@ func (f *Forge) FinalGoDepsCheckOk(check *gitpb.Repo) bool {
return false
}
// clear out the protobuf and rescan from the file
check.GoDeps = nil
if ok, _ := check.IsPrimitive(); ok {
// IsPrimitive() is expected to set GoPrimitive = true in the protobuf
if err := check.SetPrimitive(); err == nil {
log.Info("gitpb.SetPrimitive() returned true for", check.GoPath)
return true
}
// clear out the protobuf and rescan from the file
check.GoDeps = nil
if ok, err := check.ParseGoSum(); !ok {
log.Info("FinalGoDepsCheckOk() error", err)
log.Info("forge.FinalGoDepsCheckOk() error", err)
return false
}