summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-17 18:49:24 -0600
committerJeff Carr <[email protected]>2024-12-17 18:49:24 -0600
commit3a53e0bd9b893c2e5aee472baae2cc92c6b42afe (patch)
tree39037b15baf3210d64771897089eaab979c95f2d
parent93e9e4e43b964210e53e8f9455e44886dd6b2574 (diff)
more things moved to gitpbv0.22.30
-rw-r--r--goConfig.go117
1 files changed, 1 insertions, 116 deletions
diff --git a/goConfig.go b/goConfig.go
index c29e787..ab9ae83 100644
--- a/goConfig.go
+++ b/goConfig.go
@@ -6,69 +6,6 @@ import (
"go.wit.com/log"
)
-/*
-
-// readGoMod reads and parses the go.sum file
-// saves the config information in *Repo.goConfig
-func (rs *RepoStatus) parseGoSum() (bool, error) {
- tmp := filepath.Join(rs.realPath.String(), "go.sum")
- gosum, err := os.Open(tmp)
- if err != nil {
- log.Log(REPO, "missing go.sum", rs.realPath.String())
- rs.goConfig = nil
- return false, err
- }
- defer gosum.Close()
-
- var deps GoConfig
- deps = make(GoConfig)
-
- scanner := bufio.NewScanner(gosum)
- log.Log(REPO, "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")
- }
- currentversion, ok := deps[godep]
- if ok {
- // only use the first value found in the file?
- // this shouldn't have been possible. this function should
- // only be called from MakeRedomod()
- // todo: make go things a seperate package so this function
- // isn't exported?
- if version != currentversion {
- log.Log(REPOWARN, "\tgo.sum ", godep, "had both", version, currentversion)
- }
- } else {
- deps[godep] = version
- log.Log(REPO, "\t", godep, "=", version)
- }
- } else {
- // I've never seen this happen yet
- return false, errors.New("go.sum invalid: " + line)
- }
- }
-
- if err := scanner.Err(); err != nil {
- rs.goConfig = nil
- return false, err
- }
-
- rs.goConfig = deps
- return true, nil
-}
-
-func (rs *RepoStatus) GoConfig() map[string]string {
- return rs.goConfig
-}
-*/
-
// for now, even check cmd.Exit
func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
r := rs.Run(cmd)
@@ -84,62 +21,10 @@ func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
}
/*
-// poor name perhaps. It's because in most of these
-// repos you can also type "make redomod" to do the same thing
-// since it's a Makefile task that is also useful to be able to run
-// from the command line
-func (rs *RepoStatus) MakeRedomod() (bool, error) {
- if rs.ReadOnly() {
- log.Log(REPO, "will not go mod redo read only repos", rs.String())
- return false, errors.New(rs.GoPath() + " is read-only ")
- }
-
- // unset the go development ENV var to generate release files
- os.Unsetenv("GO111MODULE")
- if ok, err := rs.strictRun([]string{"rm", "-f", "go.mod", "go.sum"}); !ok {
- log.Log(REPO, "rm go.mod go.sum failed", err)
- return ok, err
- }
- if ok, err := rs.strictRun([]string{"go", "mod", "init", rs.GoPath()}); !ok {
- log.Log(REPO, "go mod init failed", err)
- return ok, err
- }
- if ok, err := rs.strictRun([]string{"go", "mod", "tidy"}); !ok {
- log.Log(REPO, "go mod tidy failed", err)
- return ok, err
- }
- if ok, err := rs.strictRun([]string{"go", "mod", "edit", "-go=1.20"}); !ok {
- log.Log(REPO, "go mod edit failed", err)
- return ok, err
- }
- log.Log(REPO, "MakeRedomod() worked", rs.GoPath())
-
- if rs.Exists("go.sum") {
- // return the attempt to parse go.mod & go.sum
- return rs.parseGoSum()
- }
- rs.goConfig = nil
- rs.primitive.SetText("false")
-
- ok, err := rs.isPrimativeGoMod()
- if err != nil {
- // this means this repo does not depend on any other package
- log.Info("PRIMATIVE repo:", rs.String(), "err =", err)
- return false, err
- }
- if ok {
- // this means the repo is primitive so there is no go.sum
- rs.primitive.SetText("true")
- return true, nil
- }
- // this should never happen
- return false, errors.New("MakeRedomod() logic failed")
-}
-*/
-
func (rs *RepoStatus) IsReleased() bool {
if rs.GetTargetVersion() == rs.GetCurrentVersion() {
return true
}
return false
}
+*/