From 412658698a6d1ad09d64723e9a10e676c77afa94 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 1 Dec 2024 16:04:07 -0600 Subject: Repotype() working somewhat --- goDep.redoGoMod.go | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'goDep.redoGoMod.go') diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go index 72249fe..d75f32a 100644 --- a/goDep.redoGoMod.go +++ b/goDep.redoGoMod.go @@ -124,6 +124,22 @@ func (repo *Repo) parseGoSum() (bool, error) { return true, nil } func (repo *Repo) RepoType() string { + if repo.GetGoPlugin() { + return "plugin" + } + if repo.GetGoBinary() { + return "binary" + } + if ok, _, _ := repo.IsProtobuf(); ok { + return "protobuf" + } + if repo.GetGoLibrary() { + return "library" + } + return "" +} + +func (repo *Repo) goListRepoType() string { os.Setenv("GO111MODULE", "off") cmd := []string{"go", "list", "-f", "'{{if eq .Name \"main\"}}binary{{else}}library{{end}}'"} // cmd := []string{"go", "list", "-f", "'{{.Name}}'"} // probably use this. this just prints out the package name @@ -221,7 +237,7 @@ func (repo *Repo) PublishedLen() int { // returns true if the last published func (all *Repos) GoDepsChanged(repo *Repo) (bool, error) { - var match bool = true + var upgrade bool = false if repo.GoDeps == nil { repo.RedoGoMod() @@ -238,9 +254,17 @@ func (all *Repos) GoDepsChanged(repo *Repo) (bool, error) { } found := repo.Published.FindByGoPath(depRepo.GetGoPath()) if found == nil { - return true, errors.New("new repo added " + depRepo.GetGoPath()) + log.Printf("dep %-50s %-10s vs %-10s", depRepo.GetGoPath(), depRepo.GetVersion(), "NEW") + upgrade = true + continue + // return upgrade, errors.New("new repo added " + depRepo.GetGoPath()) + } + if depRepo.GetVersion() == found.GetVersion() { + // log.Printf("deps %-50s %-10s vs %-10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetVersion()) + } else { + log.Printf("dep %-50s %-10s vs %-10s BROKEN", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetVersion()) + upgrade = true } - log.Printf("deps %-50s %-10s vs %-10s", depRepo.GetGoPath(), depRepo.GetVersion(), found.GetVersion()) } - return match, nil + return upgrade, nil } -- cgit v1.2.3