generate go.work file for pkgsite

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-06 04:02:46 -06:00
parent 309cf80e16
commit 678d6357b1
3 changed files with 70 additions and 57 deletions

76
draw.go
View File

@ -54,21 +54,21 @@ func (rs *RepoStatus) drawGitBranches() {
})
/*
newgrid.NewButton("show .git/config", func() {
if rs.gitConfig == nil {
log.Log(WARN, "Nonexistant or damaged .git/config", rs.String())
return
}
log.Log(WARN, ".git/config:", rs.realPath.String())
newgrid.NewButton("show .git/config", func() {
if rs.gitConfig == nil {
log.Log(WARN, "Nonexistant or damaged .git/config", rs.String())
return
}
log.Log(WARN, ".git/config:", rs.realPath.String())
// The info:
for name, remote := range rs.gitConfig.remotes {
log.Log(WARN, " ", name, "url:", remote.url)
}
for name, branch := range rs.gitConfig.branches {
log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
}
})
// The info:
for name, remote := range rs.gitConfig.remotes {
log.Log(WARN, " ", name, "url:", remote.url)
}
for name, branch := range rs.gitConfig.branches {
log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
}
})
*/
newgrid.NewButton("CheckDirty()", func() {
@ -80,31 +80,31 @@ func (rs *RepoStatus) drawGitBranches() {
})
/*
newgrid.NewButton("CheckSafeGoSumRemake()", func() {
if ok, bad := rs.CheckSafeGoSumRemake(); ok {
log.Log(WARN, "CheckSafeGoSumRemake() is safe to redo")
} else {
log.Log(WARN, "CheckSafeGoSumRemake() is not safe. problems:", bad)
}
})
newgrid.NewButton("CheckSafeGoSumRemake()", func() {
if ok, bad := rs.CheckSafeGoSumRemake(); ok {
log.Log(WARN, "CheckSafeGoSumRemake() is safe to redo")
} else {
log.Log(WARN, "CheckSafeGoSumRemake() is not safe. problems:", bad)
}
})
newgrid.NewButton("CheckGoSum()", func() {
if ok, missing := rs.CheckGoSum(); ok {
log.Log(WARN, "CheckGoSum() is ok")
} else {
log.Log(WARN, "CheckGoSum() is not ok. missing:", missing)
}
})
newgrid.NewButton("CheckPrimativeGoMod()", func() {
if rs.CheckPrimativeGoMod() {
log.Log(WARN, "is primative")
} else {
log.Log(WARN, "is not primative")
}
})
newgrid.NewButton("MakeRedomod()", func() {
rs.MakeRedomod()
})
newgrid.NewButton("CheckGoSum()", func() {
if ok, missing := rs.CheckGoSum(); ok {
log.Log(WARN, "CheckGoSum() is ok")
} else {
log.Log(WARN, "CheckGoSum() is not ok. missing:", missing)
}
})
newgrid.NewButton("CheckPrimativeGoMod()", func() {
if rs.CheckPrimativeGoMod() {
log.Log(WARN, "is primative")
} else {
log.Log(WARN, "is not primative")
}
})
newgrid.NewButton("MakeRedomod()", func() {
rs.MakeRedomod()
})
*/
}

View File

@ -367,26 +367,26 @@ func (rs *RepoStatus) CheckSafeGoSumRemake() (bool, []string) {
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
log.Log(WARN, " go get", depname, err, output)
/*
switch goSumS {
case "SAFE":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE SAFE REPO")
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
log.Log(WARN, " go get", depname, err, output)
case "CLEAN":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE CLEAN REPO")
case "PRIMATIVE":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE PRIMATIVE REPO")
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
log.Log(WARN, " go get", depname, err, output)
default:
log.Log(WARN, " USER VERSIONS MISMATCH default", version, userversion)
clean = append(clean, deprs.String())
if myGoSumS == "UNCHANGED" {
switch goSumS {
case "SAFE":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE SAFE REPO")
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
log.Log(WARN, " go get", depname, err, output)
case "CLEAN":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE CLEAN REPO")
case "PRIMATIVE":
log.Log(WARN, " USER VERSIONS MISMATCH", version, userversion)
log.Log(WARN, " IGNORE PRIMATIVE REPO")
err, output := rs.RunCmd([]string{"go", "get", depname + "@" + userversion})
log.Log(WARN, " go get", depname, err, output)
default:
log.Log(WARN, " USER VERSIONS MISMATCH default", version, userversion)
clean = append(clean, deprs.String())
if myGoSumS == "UNCHANGED" {
}
}
}
*/
}
}

13
unix.go
View File

@ -212,6 +212,19 @@ func IsDirectory(path string) bool {
return info.IsDir()
}
func (rs *RepoStatus) Exists(filename string) bool {
usr, err := user.Current()
if err != nil {
log.Error(err, "Exists() error: could not determine what your username is")
return false
}
testf := filepath.Join(usr.HomeDir, "go/src/", rs.String(), filename)
if Exists(testf) {
return true
}
return false
}
// returns true if the file exists
func Exists(file string) bool {
_, err := os.Stat(file)