go.work files should be git metadata

This commit is contained in:
Jeff Carr 2024-12-18 20:08:48 -06:00
parent 54c70eb166
commit 35fdbe3150
2 changed files with 12 additions and 36 deletions

View File

@ -50,40 +50,13 @@ func findNext() bool {
}
findCounter += 1
if check.Exists("go.mod") {
log.Info("go.mod exists here")
} else {
log.Info("go.mod is gone here")
}
if ok, err := check.ParseGoSum(); !ok {
log.Info("ParseGoSum() failed (probably repo needs go mod tidy)", err)
log.Info("ParseGoSum() findFix =", findFix, "findCounter =", findCounter)
if check.Exists("go.mod") {
log.Info("go.mod exists here")
} else {
log.Info("go.mod is gone here")
}
if !check.ParseGoSum() {
continue
}
if check.Exists("go.mod") {
log.Info("go.mod exists here")
} else {
log.Info("go.mod is gone here")
}
if me.forge.FinalGoDepsCheckOk(check) {
setCurrentRepo(check, "should be good to release", "pretty sure")
if check.Exists("go.mod") {
log.Info("go.mod exists here")
} else {
log.Info("go.mod is gone here")
}
return true
}
if check.Exists("go.mod") {
log.Info("go.mod exists here")
} else {
log.Info("go.mod is gone here")
}
log.Info("findNext() got to the end. repo", check.GetGoPath(), "did not work. trying to find a new one now")
}
if findCounter == 0 {
@ -97,11 +70,11 @@ func findNext() bool {
return false
}
func runGoClean(check *gitpb.Repo) bool {
func runGoClean(check *gitpb.Repo, myarg string) bool {
// check if the package dependancies changed, if so, re-publish
check.GoDeps = nil
cmd := []string{"go-mod-clean", "--strict"}
cmd := []string{"go-mod-clean", myarg}
log.Info("Running", cmd, "in", check.GetGoPath())
result := check.Run(cmd)
if result.Error != nil {
@ -120,17 +93,17 @@ func runGoClean(check *gitpb.Repo) bool {
log.Info(strings.Join(result.Stderr, "\n"))
return false
}
if ok, err := check.ParseGoSum(); !ok {
log.Info("ParseGoSum() failed", err)
return false
if check.ParseGoSum() {
return true
}
return true
log.Info("ParseGoSum() failed")
return false
}
// tries to fix the go.mod and go.sum files
func fixGodeps(check *gitpb.Repo) bool {
var good bool = true
if !runGoClean(check) {
if !runGoClean(check, "--strict") {
return false
}
// skip primative ones

View File

@ -1,6 +1,8 @@
package main
import (
"os"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@ -41,8 +43,9 @@ func forceReleaseVersion(repo *gitpb.Repo) {
// empty git notes
repo.Run([]string{"git", "notes", "remove"})
if !runGoClean(repo) {
if !runGoClean(repo, "--restore") {
log.Info("go-mod-clean probably failed here. that's ok", repo.GetGoPath())
os.Exit(-1)
}
}