go.work files should be git metadata
This commit is contained in:
parent
54c70eb166
commit
35fdbe3150
43
findNext.go
43
findNext.go
|
@ -50,40 +50,13 @@ func findNext() bool {
|
||||||
|
|
||||||
}
|
}
|
||||||
findCounter += 1
|
findCounter += 1
|
||||||
if check.Exists("go.mod") {
|
if !check.ParseGoSum() {
|
||||||
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")
|
|
||||||
}
|
|
||||||
continue
|
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) {
|
if me.forge.FinalGoDepsCheckOk(check) {
|
||||||
setCurrentRepo(check, "should be good to release", "pretty sure")
|
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
|
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")
|
log.Info("findNext() got to the end. repo", check.GetGoPath(), "did not work. trying to find a new one now")
|
||||||
}
|
}
|
||||||
if findCounter == 0 {
|
if findCounter == 0 {
|
||||||
|
@ -97,11 +70,11 @@ func findNext() bool {
|
||||||
return false
|
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 if the package dependancies changed, if so, re-publish
|
||||||
check.GoDeps = nil
|
check.GoDeps = nil
|
||||||
|
|
||||||
cmd := []string{"go-mod-clean", "--strict"}
|
cmd := []string{"go-mod-clean", myarg}
|
||||||
log.Info("Running", cmd, "in", check.GetGoPath())
|
log.Info("Running", cmd, "in", check.GetGoPath())
|
||||||
result := check.Run(cmd)
|
result := check.Run(cmd)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
|
@ -120,17 +93,17 @@ func runGoClean(check *gitpb.Repo) bool {
|
||||||
log.Info(strings.Join(result.Stderr, "\n"))
|
log.Info(strings.Join(result.Stderr, "\n"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if ok, err := check.ParseGoSum(); !ok {
|
if check.ParseGoSum() {
|
||||||
log.Info("ParseGoSum() failed", err)
|
return true
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
return true
|
log.Info("ParseGoSum() failed")
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// tries to fix the go.mod and go.sum files
|
// tries to fix the go.mod and go.sum files
|
||||||
func fixGodeps(check *gitpb.Repo) bool {
|
func fixGodeps(check *gitpb.Repo) bool {
|
||||||
var good bool = true
|
var good bool = true
|
||||||
if !runGoClean(check) {
|
if !runGoClean(check, "--strict") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// skip primative ones
|
// skip primative ones
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -41,8 +43,9 @@ func forceReleaseVersion(repo *gitpb.Repo) {
|
||||||
// empty git notes
|
// empty git notes
|
||||||
repo.Run([]string{"git", "notes", "remove"})
|
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())
|
log.Info("go-mod-clean probably failed here. that's ok", repo.GetGoPath())
|
||||||
|
os.Exit(-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue