summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-08 03:13:09 -0600
committerJeff Carr <[email protected]>2025-01-08 03:13:09 -0600
commitb0fca659c57dd2cb6a88a74d1a349117a3908124 (patch)
treed1e43473858cead9872a4652aaaeed85dd2afd38
parentebda2ea222ed9f1d348d5d3e0cffb9c9f9c0acec (diff)
fix the dumb names
-rw-r--r--age.go2
-rw-r--r--checkout.go8
-rw-r--r--currentVersions.go40
-rw-r--r--isPrimitive.go12
-rw-r--r--log.go8
-rw-r--r--reload.go12
-rw-r--r--reloadBranches.go8
-rw-r--r--reloadCheckDirty.go2
-rw-r--r--reloadTags.go2
-rw-r--r--repo.merge.go4
-rw-r--r--repo.protofiles.go4
-rw-r--r--rill.go8
-rw-r--r--shell.go8
13 files changed, 59 insertions, 59 deletions
diff --git a/age.go b/age.go
index 1249a6e..49eea1a 100644
--- a/age.go
+++ b/age.go
@@ -65,6 +65,6 @@ func (repo *Repo) oldMtime(filename string) (time.Time, error) {
if err == nil {
return statf.ModTime(), nil
}
- log.Log(GITPBWARN, "Mtime() os.Stat() error", pathf, err)
+ log.Log(WARN, "Mtime() os.Stat() error", pathf, err)
return time.Now(), err
}
diff --git a/checkout.go b/checkout.go
index 0b88250..b25f169 100644
--- a/checkout.go
+++ b/checkout.go
@@ -42,21 +42,21 @@ func (repo *Repo) checkoutBranch(bName string) bool {
return false
}
if repo.CheckDirty() {
- log.Log(GITPB, repo.GetFullPath(), "is dirty")
+ log.Log(INFO, repo.GetFullPath(), "is dirty")
return false
}
cmd := []string{"git", "checkout", bName}
r := repo.Run(cmd)
if r.Error != nil {
- log.Log(GITPB, "git checkout error:", r.Error)
+ log.Log(INFO, "git checkout error:", r.Error)
}
realname := repo.GetCurrentBranchName()
realversion := repo.GetCurrentBranchVersion()
- log.Log(GITPB, repo.GetFullPath(), "realname =", realname, "realversion =", realversion)
+ log.Log(INFO, repo.GetFullPath(), "realname =", realname, "realversion =", realversion)
if realname != bName {
- log.Log(GITPB, "git checkout failed", repo.GetFullPath(), bName, "!=", realname)
+ log.Log(INFO, "git checkout failed", repo.GetFullPath(), bName, "!=", realname)
return false
}
return true
diff --git a/currentVersions.go b/currentVersions.go
index 65e40ed..6eeee18 100644
--- a/currentVersions.go
+++ b/currentVersions.go
@@ -37,7 +37,7 @@ func (repo *Repo) setMasterVersion() {
if err == nil {
repo.MasterVersion = v
} else {
- log.Log(GITPBWARN, "gitpb.GitMasterVersion() error:", err)
+ log.Log(WARN, "gitpb.GitMasterVersion() error:", err)
repo.MasterVersion = "giterr"
}
}
@@ -48,7 +48,7 @@ func (repo *Repo) setDevelVersion() {
if err == nil {
repo.DevelVersion = v
} else {
- log.Log(GITPBWARN, "gitpb.GitDevelVersion() error:", err)
+ log.Log(WARN, "gitpb.GitDevelVersion() error:", err)
repo.DevelVersion = "deverr"
}
}
@@ -59,7 +59,7 @@ func (repo *Repo) setUserVersion() {
if err == nil {
repo.UserVersion = v
} else {
- log.Log(GITPBWARN, "gitpb.GitUserVersion() error:", err)
+ log.Log(WARN, "gitpb.GitUserVersion() error:", err)
repo.UserVersion = "uerr"
}
}
@@ -70,8 +70,8 @@ func (repo *Repo) GetCurrentBranchName() string {
r := repo.RunQuiet([]string{"git", "branch", "--show-current"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
- log.Log(GITPBWARN, "GetCurrentBranchName() output might have worked anyway:", output)
+ log.Log(WARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
+ log.Log(WARN, "GetCurrentBranchName() output might have worked anyway:", output)
}
return strings.TrimSpace(output)
}
@@ -145,25 +145,25 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "gitDescribeByName() output might have worked anyway:", output)
- log.Log(GITPBWARN, "gitDescribeByName() not in a git repo?", r.Error, repo.GetGoPath())
+ log.Log(WARN, "gitDescribeByName() output might have worked anyway:", output)
+ log.Log(WARN, "gitDescribeByName() not in a git repo?", r.Error, repo.GetGoPath())
return "", r.Error
}
return strings.TrimSpace(output), nil
}
if !repo.IsBranch(name) {
// tag does not exist
- log.Log(GITPBWARN, "LocalTagExists()", name, "did not exist")
+ log.Log(WARN, "LocalTagExists()", name, "did not exist")
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name)
}
cmd := []string{"git", "describe", "--tags", "--always", name}
result := repo.RunQuiet(cmd)
output := strings.Join(result.Stdout, "\n")
if result.Error != nil {
- log.Log(GITPBWARN, "cmd =", cmd)
- log.Log(GITPBWARN, "err =", result.Error)
- log.Log(GITPBWARN, "output (might have worked with error?) =", output)
- log.Log(GITPBWARN, "not in a git repo or bad tag?", repo.GetGoPath())
+ log.Log(WARN, "cmd =", cmd)
+ log.Log(WARN, "err =", result.Error)
+ log.Log(WARN, "output (might have worked with error?) =", output)
+ log.Log(WARN, "not in a git repo or bad tag?", repo.GetGoPath())
return "", result.Error
}
@@ -188,13 +188,13 @@ func (repo *Repo) IsBranch(findname string) bool {
continue
}
path, filename := filepath.Split(tagname)
- log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
+ log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
if filename == findname {
- log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
+ log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
return true
}
}
- log.Log(GITPB, "did not find tag:", findname, "in", repo.GetGoPath())
+ log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
return false
}
@@ -210,13 +210,13 @@ func (repo *Repo) IsLocalBranch(findname string) bool {
continue
}
path, filename := filepath.Split(tagname)
- log.Log(GITPB, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
+ log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
if filename == findname {
- log.Log(GITPB, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
+ log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
return true
}
}
- log.Log(GITPB, "did not find tag:", findname, "in", repo.GetGoPath())
+ log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
return false
}
@@ -237,11 +237,11 @@ func normalizeVersion(s string) string {
}
reg, err := regexp.Compile("[^0-9.]+")
if err != nil {
- log.Log(GITPBWARN, "normalizeVersion() regexp.Compile() ERROR =", err)
+ log.Log(WARN, "normalizeVersion() regexp.Compile() ERROR =", err)
return parts[0]
}
clean := reg.ReplaceAllString(parts[0], "")
- log.Log(GITPB, "normalizeVersion() s =", clean)
+ log.Log(INFO, "normalizeVersion() s =", clean)
return clean
}
diff --git a/isPrimitive.go b/isPrimitive.go
index e55665e..e935cec 100644
--- a/isPrimitive.go
+++ b/isPrimitive.go
@@ -28,11 +28,11 @@ func (repo *Repo) setPrimitive() error {
// it assumes go mod ran init and tidy ran without error
func (repo *Repo) computePrimitive() (bool, error) {
// go mod init & go mod tidy ran without errors
- log.Log(GITPB, "isPrimitiveGoMod()", repo.FullPath)
+ log.Log(INFO, "isPrimitiveGoMod()", repo.FullPath)
tmp := filepath.Join(repo.FullPath, "go.mod")
gomod, err := os.Open(tmp)
if err != nil {
- log.Log(GITPB, "missing go.mod", repo.FullPath)
+ log.Log(INFO, "missing go.mod", repo.FullPath)
return false, err
}
defer gomod.Close()
@@ -47,17 +47,17 @@ func (repo *Repo) computePrimitive() (bool, error) {
line := strings.TrimSpace(scanner.Text())
parts := strings.Fields(line)
- log.Log(GITPB, " gomod:", parts)
+ log.Log(INFO, " gomod:", parts)
if len(parts) >= 1 {
- log.Log(GITPB, " gomod: part[0] =", parts[0])
+ log.Log(INFO, " gomod: part[0] =", parts[0])
if parts[0] == "require" {
- log.Log(GITPB, " should return false here")
+ log.Log(INFO, " should return false here")
return false, errors.New("go.mod file is not primitive")
}
/*
if parts[0] == "go" {
if parts[1] != "1.21" {
- log.Log(GITPBWARN, "go not set to 1.21 for", repo.GetGoPath())
+ log.Log(WARN, "go not set to 1.21 for", repo.GetGoPath())
// return false, errors.New("go not set to 1.21 for " + repo.GetGoPath())
}
}
diff --git a/log.go b/log.go
index df58886..da1bc10 100644
--- a/log.go
+++ b/log.go
@@ -4,13 +4,13 @@ import (
"go.wit.com/log"
)
-var GITPB *log.LogFlag
-var GITPBWARN *log.LogFlag
+var INFO *log.LogFlag
+var WARN *log.LogFlag
func init() {
full := "go.wit.com/lib/protobuf/gitpb"
short := "gitpb"
- GITPB = log.NewFlag("GITPB", false, full, short, "general gitpb things")
- GITPBWARN = log.NewFlag("GITPBWARN", true, full, short, "gitpb warnings")
+ INFO = log.NewFlag("INFO", false, full, short, "general gitpb things")
+ WARN = log.NewFlag("WARN", true, full, short, "gitpb warnings")
}
diff --git a/reload.go b/reload.go
index 5329561..3ac55c1 100644
--- a/reload.go
+++ b/reload.go
@@ -48,7 +48,7 @@ func (repo *Repo) setLastTag() {
// log.Info("getLastTagVersion()", result.Stdout)
if len(result.Stdout) != 1 {
- log.Log(GITPBWARN, "git LastTag() error:", result.Stdout)
+ log.Log(WARN, "git LastTag() error:", result.Stdout)
repo.LastTag = ""
return
}
@@ -59,7 +59,7 @@ func (repo *Repo) setLastTag() {
result = repo.RunQuiet(cmd)
if len(result.Stdout) != 1 {
- log.Log(GITPBWARN, "git LastTag() error:", result.Stdout)
+ log.Log(WARN, "git LastTag() error:", result.Stdout)
repo.LastTag = ""
return
}
@@ -72,8 +72,8 @@ func (repo *Repo) setCurrentBranchName() {
r := repo.RunQuiet([]string{"git", "branch", "--show-current"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
- log.Log(GITPBWARN, "GetCurrentBranchName() output might have worked anyway:", output)
+ log.Log(WARN, "GetCurrentBranchName() not in a git repo?", r.Error, repo.GetGoPath())
+ log.Log(WARN, "GetCurrentBranchName() output might have worked anyway:", output)
}
repo.CurrentBranchName = strings.TrimSpace(output)
}
@@ -88,8 +88,8 @@ func (repo *Repo) setCurrentBranchVersion() {
r := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
output := strings.Join(r.Stdout, "\n")
if r.Error != nil {
- log.Log(GITPBWARN, "GetCurrentBranchVersion() not in a git repo?", r.Error, repo.GetGoPath())
- log.Log(GITPBWARN, "GetCurrentBranchVersion() output might have worked anyway:", output)
+ log.Log(WARN, "GetCurrentBranchVersion() not in a git repo?", r.Error, repo.GetGoPath())
+ log.Log(WARN, "GetCurrentBranchVersion() output might have worked anyway:", output)
}
repo.CurrentBranchVersion = strings.TrimSpace(output)
}
diff --git a/reloadBranches.go b/reloadBranches.go
index be58dfd..cfae561 100644
--- a/reloadBranches.go
+++ b/reloadBranches.go
@@ -52,17 +52,17 @@ func (repo *Repo) CheckBranches() bool {
}
var cmd []string
cmd = append(cmd, "git", "show", "-s", "--format=%ci", hash)
- r := shell.PathRunLog(repo.GetFullPath(), cmd, GITPB)
+ r := shell.PathRunLog(repo.GetFullPath(), cmd, INFO)
if r.Error != nil {
- log.Log(GITPBWARN, "CheckBranches() git show error:", r.Error)
+ log.Log(WARN, "CheckBranches() git show error:", r.Error)
}
// git show -s --format=%ci <hash> will give you the time
// log.Log(REPO, fullfile)
if hash == hashCheck {
// log.Info("notsure why this git show is here", hash)
} else {
- log.Log(GITPBWARN, repo.GetFullPath(), hash, r.Stdout, b)
- log.Log(GITPBWARN, "UNKNOWN BRANCHES IN THIS REPO", cmd)
+ log.Log(WARN, repo.GetFullPath(), hash, r.Stdout, b)
+ log.Log(WARN, "UNKNOWN BRANCHES IN THIS REPO", cmd)
// repo.versionCmdOutput.SetText("UNKNOWN BRANCHES")
perfect = false
// parts := strings.Split(b, "/")
diff --git a/reloadCheckDirty.go b/reloadCheckDirty.go
index 463397e..ae7b489 100644
--- a/reloadCheckDirty.go
+++ b/reloadCheckDirty.go
@@ -25,7 +25,7 @@ func (repo *Repo) IsDirty() bool {
// actually os.Exec('git')
func (repo *Repo) CheckDirty() bool {
cmd := []string{"git", "status", "--porcelain"}
- r := shell.PathRunLog(repo.FullPath, cmd, GITPB)
+ r := shell.PathRunLog(repo.FullPath, cmd, INFO)
if r.Error != nil {
log.Warn("CheckDirty() status cmd =", cmd)
out := strings.Join(r.Stdout, "\n")
diff --git a/reloadTags.go b/reloadTags.go
index 2510ff1..827e1ef 100644
--- a/reloadTags.go
+++ b/reloadTags.go
@@ -141,7 +141,7 @@ func (repo *Repo) IsOnlyLocalTag(taggy string) bool {
if strings.HasPrefix(tagname, "refs/remotes") {
path, filename := filepath.Split(tagname)
if filename == taggy {
- log.Log(GITPB, "found tag:", path, filename, "from", repo.GetGoPath())
+ log.Log(INFO, "found tag:", path, filename, "from", repo.GetGoPath())
return false
}
}
diff --git a/repo.merge.go b/repo.merge.go
index 9507459..6dbb35e 100644
--- a/repo.merge.go
+++ b/repo.merge.go
@@ -18,7 +18,7 @@ func (rs *Repo) MergeUserToDevel() (*cmd.Status, error) {
all = append(all, []string{"git", "push"})
if result, err := rs.RunStrictAll(all); err != nil {
- log.Log(GITPBWARN, "MergeUserToDevel() failed", rs.GetFullPath())
+ log.Log(WARN, "MergeUserToDevel() failed", rs.GetFullPath())
return result, err
}
return nil, nil
@@ -37,7 +37,7 @@ func (rs *Repo) MergeDevelToMaster() (*cmd.Status, error) {
all = append(all, []string{"git", "push"})
if result, err := rs.RunStrictAll(all); err != nil {
- log.Log(GITPBWARN, "MergeDevelToMaster() failed", rs.GetFullPath())
+ log.Log(WARN, "MergeDevelToMaster() failed", rs.GetFullPath())
return result, err
}
return nil, nil
diff --git a/repo.protofiles.go b/repo.protofiles.go
index 638bfcb..146f506 100644
--- a/repo.protofiles.go
+++ b/repo.protofiles.go
@@ -64,7 +64,7 @@ func scanForProtobuf(srcDir string) ([]string, []string, error) {
var compiled []string
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
- log.Log(GITPBWARN, "Error accessing path:", path, err)
+ log.Log(WARN, "Error accessing path:", path, err)
return err
}
@@ -97,7 +97,7 @@ func (repo *Repo) GetProtoFiles() ([]string, error) {
srcDir := repo.GetFullPath()
err := filepath.Walk(srcDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
- log.Log(GITPBWARN, "Error accessing path:", path, err)
+ log.Log(WARN, "Error accessing path:", path, err)
return err
}
diff --git a/rill.go b/rill.go
index 78c1de0..d6dc2a1 100644
--- a/rill.go
+++ b/rill.go
@@ -38,15 +38,15 @@ func (repo *Repo) GitPull() cmd.Status {
/*
if r.Error == nil {
if r.Exit == 0 {
- log.Log(GITPBWARN, "git pull ran ", repo.GetGoPath())
- // log.Log(GITPBWARN, "git pull output", output)
+ log.Log(WARN, "git pull ran ", repo.GetGoPath())
+ // log.Log(WARN, "git pull output", output)
return r
} else {
- log.Log(GITPBWARN, "git pull error", repo.GetGoPath(), strings.Join(r.Stderr, "\n"))
+ log.Log(WARN, "git pull error", repo.GetGoPath(), strings.Join(r.Stderr, "\n"))
return r
}
}
- log.Log(GITPBWARN, "git pull error", repo.GetGoPath(), r.Error)
+ log.Log(WARN, "git pull error", repo.GetGoPath(), r.Error)
*/
return r
}
diff --git a/shell.go b/shell.go
index 41fe34a..2a259a7 100644
--- a/shell.go
+++ b/shell.go
@@ -129,11 +129,11 @@ func (repo *Repo) IsDirectory() bool {
func (repo *Repo) RunAll(all [][]string) bool {
for _, cmd := range all {
- log.Log(GITPBWARN, "doAll() RUNNING: cmd =", cmd)
+ log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
r := repo.Run(cmd)
if r.Error != nil {
- log.Log(GITPBWARN, "doAll() err =", r.Error)
- log.Log(GITPBWARN, "doAll() out =", r.Stdout)
+ log.Log(WARN, "doAll() err =", r.Error)
+ log.Log(WARN, "doAll() out =", r.Stdout)
return false
}
}
@@ -142,7 +142,7 @@ func (repo *Repo) RunAll(all [][]string) bool {
func (repo *Repo) RunStrictAll(all [][]string) (*cmd.Status, error) {
for _, cmd := range all {
- log.Log(GITPBWARN, "doAll() RUNNING: cmd =", cmd)
+ log.Log(WARN, "doAll() RUNNING: cmd =", cmd)
if result, err := repo.RunStrictNew(cmd); err != nil {
return result, err
}