summaryrefslogtreecommitdiff
path: root/goDep.redoGoMod.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-03 00:35:50 -0600
committerJeff Carr <[email protected]>2024-12-03 00:35:50 -0600
commit1d1d8e7eea642cd3fc546101b4899ec1db81e3b7 (patch)
tree0a313aa1a49b1aeaacfc3df802171193ed76a324 /goDep.redoGoMod.go
parent7a90613c91fa5c06b6fbe5a7a6e48fbba722877d (diff)
lots of code hopefully better than before
Diffstat (limited to 'goDep.redoGoMod.go')
-rw-r--r--goDep.redoGoMod.go90
1 files changed, 0 insertions, 90 deletions
diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go
index 1313039..de689fd 100644
--- a/goDep.redoGoMod.go
+++ b/goDep.redoGoMod.go
@@ -3,10 +3,8 @@ package gitpb
// does processing on the go.mod and go.sum files
import (
- "bufio"
"errors"
"os"
- "path/filepath"
"strings"
"go.wit.com/log"
@@ -60,50 +58,6 @@ func (repo *Repo) RedoGoMod() (bool, error) {
return false, errors.New("MakeRedomod() logic failed")
}
-// reads and parses the go.sum file
-// does not change anything
-func (repo *Repo) ParseGoSum() (bool, error) {
- // empty out what was there before
- repo.GoDeps = nil
- tmp := filepath.Join(repo.FullPath, "go.sum")
- gosum, err := os.Open(tmp)
- if err != nil {
- log.Warn("missing go.sum", repo.FullPath)
- return false, err
- }
- defer gosum.Close()
-
- scanner := bufio.NewScanner(gosum)
- log.Info("gosum:", tmp)
- for scanner.Scan() {
- line := strings.TrimSpace(scanner.Text())
-
- parts := strings.Split(line, " ")
- if len(parts) == 3 {
- godep := strings.TrimSpace(parts[0])
- version := strings.TrimSpace(parts[1])
- if strings.HasSuffix(version, "/go.mod") {
- version = strings.TrimSuffix(version, "/go.mod")
- }
- new1 := GoDep{
- GoPath: godep,
- Version: version,
- }
- if repo.GoDeps == nil {
- repo.GoDeps = new(GoDeps)
- }
- repo.GoDeps.AppendUniqueGoPath(&new1)
- } else {
- return false, errors.New("go.sum parse error invalid: " + line)
- }
- }
-
- if err := scanner.Err(); err != nil {
- repo.GoDeps = nil
- return false, err
- }
- return true, nil
-}
func (repo *Repo) RepoType() string {
if repo == nil {
return "nil"
@@ -139,50 +93,6 @@ func (repo *Repo) goListRepoType() string {
return output
}
-// reads and parses the go.sum file
-func (repo *Repo) UpdatePublished() (bool, error) {
- // empty out what was there before
- repo.Published = nil
- tmp := filepath.Join(repo.FullPath, "go.sum")
- gosum, err := os.Open(tmp)
- if err != nil {
- log.Warn("missing go.sum", repo.FullPath)
- return false, err
- }
- defer gosum.Close()
-
- scanner := bufio.NewScanner(gosum)
- log.Info("gosum:", tmp)
- for scanner.Scan() {
- line := strings.TrimSpace(scanner.Text())
-
- parts := strings.Split(line, " ")
- if len(parts) == 3 {
- godep := strings.TrimSpace(parts[0])
- version := strings.TrimSpace(parts[1])
- if strings.HasSuffix(version, "/go.mod") {
- version = strings.TrimSuffix(version, "/go.mod")
- }
- new1 := GoDep{
- GoPath: godep,
- Version: version,
- }
- if repo.Published == nil {
- repo.Published = new(GoDeps)
- }
- repo.Published.AppendUniqueGoPath(&new1)
- } else {
- return false, errors.New("go.sum parse error invalid: " + line)
- }
- }
-
- if err := scanner.Err(); err != nil {
- repo.Published = nil
- return false, err
- }
- return true, nil
-}
-
// returns true if the last published
func (repo *Repo) GoDepsLen() int {
if repo.GoDeps == nil {