this is annoying

This commit is contained in:
Jeff Carr 2024-12-18 20:09:18 -06:00
parent 406817d5b2
commit 36fdd99d15
2 changed files with 14 additions and 11 deletions

View File

@ -4,7 +4,6 @@ package gitpb
import ( import (
"bufio" "bufio"
"errors"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -14,25 +13,27 @@ import (
// reads and parses the go.sum file // reads and parses the go.sum file
// does not change anything // does not change anything
func (repo *Repo) ParseGoSum() (bool, error) { func (repo *Repo) ParseGoSum() bool {
// empty out what was there before // empty out what was there before
repo.GoDeps = nil repo.GoDeps = nil
// check of the repo is a primitive // check of the repo is a primitive
// that means, there is not a go.sum file // that means, there is not a go.sum file
// because the package is completely self contained! // because the package is completely self contained!
if err := repo.SetPrimitive(); err != nil { if err := repo.setPrimitive(); err != nil {
return false, err log.Info("gitpb.ParseGoSum()", err)
return false
} }
if repo.GetGoPrimitive() { if repo.GetGoPrimitive() {
log.Info("This repo is primitive!") // log.Info("This repo is primitive!")
return true, nil return true
} }
tmp := filepath.Join(repo.FullPath, "go.sum") tmp := filepath.Join(repo.FullPath, "go.sum")
gosum, err := os.Open(tmp) gosum, err := os.Open(tmp)
defer gosum.Close() defer gosum.Close()
if err != nil { if err != nil {
return false, err log.Info("gitpb.ParseGoSum()", err)
return false
} }
scanner := bufio.NewScanner(gosum) scanner := bufio.NewScanner(gosum)
@ -56,15 +57,17 @@ func (repo *Repo) ParseGoSum() (bool, error) {
} }
repo.GoDeps.AppendUniqueGoPath(&new1) repo.GoDeps.AppendUniqueGoPath(&new1)
} else { } 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 { if err := scanner.Err(); err != nil {
repo.GoDeps = nil repo.GoDeps = nil
return false, err log.Info("gitpb.ParseGoSum()", err)
return false
} }
return true, nil return true
} }
/* /*

View File

@ -17,7 +17,7 @@ import (
// deprecate use of IsPrimitive() to this function // deprecate use of IsPrimitive() to this function
// this assumes go.mod and go.sum are in a releasable state // 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() _, err := repo.computePrimitive()
return err return err
} }