From 36fdd99d158332a1efb84c8f911e981c746bf2b0 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 18 Dec 2024 20:09:18 -0600 Subject: [PATCH] this is annoying --- goDep.parseGoSum.go | 23 +++++++++++++---------- isPrimitive.go | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/goDep.parseGoSum.go b/goDep.parseGoSum.go index b2b3d04..e99e61e 100644 --- a/goDep.parseGoSum.go +++ b/goDep.parseGoSum.go @@ -4,7 +4,6 @@ package gitpb import ( "bufio" - "errors" "os" "path/filepath" "strings" @@ -14,25 +13,27 @@ import ( // reads and parses the go.sum file // does not change anything -func (repo *Repo) ParseGoSum() (bool, error) { +func (repo *Repo) ParseGoSum() bool { // empty out what was there before repo.GoDeps = nil // check of the repo is a primitive // that means, there is not a go.sum file // because the package is completely self contained! - if err := repo.SetPrimitive(); err != nil { - return false, err + if err := repo.setPrimitive(); err != nil { + log.Info("gitpb.ParseGoSum()", err) + return false } if repo.GetGoPrimitive() { - log.Info("This repo is primitive!") - return true, nil + // log.Info("This repo is primitive!") + return true } tmp := filepath.Join(repo.FullPath, "go.sum") gosum, err := os.Open(tmp) defer gosum.Close() if err != nil { - return false, err + log.Info("gitpb.ParseGoSum()", err) + return false } scanner := bufio.NewScanner(gosum) @@ -56,15 +57,17 @@ func (repo *Repo) ParseGoSum() (bool, error) { } repo.GoDeps.AppendUniqueGoPath(&new1) } else { - return false, errors.New("go.sum parse error invalid: " + line) + log.Info("gitpb.ParseGoSum() go.sum parse error invalid:", line) + return false } } if err := scanner.Err(); err != nil { repo.GoDeps = nil - return false, err + log.Info("gitpb.ParseGoSum()", err) + return false } - return true, nil + return true } /* diff --git a/isPrimitive.go b/isPrimitive.go index 6ce67f8..e55665e 100644 --- a/isPrimitive.go +++ b/isPrimitive.go @@ -17,7 +17,7 @@ import ( // deprecate use of IsPrimitive() to this function // this assumes go.mod and go.sum are in a releasable state -func (repo *Repo) SetPrimitive() error { +func (repo *Repo) setPrimitive() error { _, err := repo.computePrimitive() return err }