moving go.mod handling here

This commit is contained in:
Jeff Carr 2024-11-30 02:03:32 -06:00
parent 5d28c6741a
commit 3de739288b
2 changed files with 6 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import (
// 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 (repo *Repo) MakeRedomod() (bool, error) {
func (repo *Repo) RedoGoMod() (bool, error) {
// unset the go development ENV var to generate release files
os.Unsetenv("GO111MODULE")
if ok, err := repo.strictRun([]string{"rm", "-f", "go.mod", "go.sum"}); !ok {
@ -32,12 +32,11 @@ func (repo *Repo) MakeRedomod() (bool, error) {
return ok, err
}
// most things should build with golang after 1.20
// TODO: move this to autogenpb
if ok, err := repo.strictRun([]string{"go", "mod", "edit", "-go=1.20"}); !ok {
log.Warn("go mod edit failed", err)
return ok, err
}
log.Info("MakeRedomod() worked", repo.GoPath)
// log.Info("MakeRedomod() worked", repo.GoPath)
if repo.Exists("go.sum") {
// return the attempt to parse go.mod & go.sum
@ -89,6 +88,9 @@ func (repo *Repo) parseGoSum() (bool, error) {
GoPath: godep,
Version: version,
}
if repo.GoDeps == nil {
repo.GoDeps = new(GoDeps)
}
repo.GoDeps.AppendUniqueGoPath(&new1)
/*
found := repo.FindGoDepByPath(godep)

View File

@ -36,7 +36,7 @@ func (repo *Repo) RunQuiet(cmd []string) cmd.Status {
// for now, even check cmd.Exit
func (repo *Repo) strictRun(cmd []string) (bool, error) {
result := repo.Run(cmd)
result := repo.RunQuiet(cmd)
if result.Error != nil {
log.Warn("go mod init failed err:", result.Error)
return false, result.Error