this is annoying
This commit is contained in:
parent
406817d5b2
commit
36fdd99d15
|
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue