diff options
Diffstat (limited to 'goDep.parseGoSum.go')
| -rw-r--r-- | goDep.parseGoSum.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/goDep.parseGoSum.go b/goDep.parseGoSum.go index 00ed073..c8a219f 100644 --- a/goDep.parseGoSum.go +++ b/goDep.parseGoSum.go @@ -14,8 +14,8 @@ import ( "go.wit.com/log" ) -// reads and parses the go.sum file -// does not change anything +// reads and parses the go.sum file into a protobuf struct +// this function isn't supposed to change anything, just parse the existing files func (repo *Repo) ParseGoSum() bool { // empty out what was there before repo.GoDeps = nil @@ -75,7 +75,7 @@ func (repo *Repo) ParseGoSum() bool { // attempt to parse go.* files in a directory func GoSumParseDir(moddir string) (*GoDeps, error) { - isprim, err := computePrimitiveNew(moddir) + isprim, err := computePrimitive(moddir) if err != nil { // "go mod init" failed return nil, err @@ -85,14 +85,14 @@ func GoSumParseDir(moddir string) (*GoDeps, error) { return nil, nil } // go.sum exists. parse the go.sum file - return parseGoSumNew(moddir) + return parseGoSum(moddir) } // Detect a 'Primitive' package. Sets the isPrimitive flag // will return true if the repo is truly not dependent on _anything_ else // like spew or lib/widget // it assumes 'go mod init' and 'go mod tidy' ran without error -func computePrimitiveNew(moddir string) (bool, error) { +func computePrimitive(moddir string) (bool, error) { // go mod init & go mod tidy ran without errors log.Log(INFO, "isPrimitiveGoMod()", moddir) gomod, err := os.Open(filepath.Join(moddir, "go.mod")) @@ -131,7 +131,8 @@ func computePrimitiveNew(moddir string) (bool, error) { return true, nil } -func parseGoSumNew(moddir string) (*GoDeps, error) { +// parse the go.sum file into a protobuf +func parseGoSum(moddir string) (*GoDeps, error) { godeps := new(GoDeps) tmp, err := os.Open(filepath.Join(moddir, "go.sum")) |
