lame oversight on my part

This commit is contained in:
Jeff Carr 2025-01-30 14:11:45 -06:00
parent 9c7572ca45
commit 8130ffd25b
1 changed files with 17 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"errors" "errors"
"os"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
@ -59,8 +60,15 @@ func doStrict(repo *gitpb.Repo) error {
log.Info(repo.GetGoPath(), "GOING TO MAKE NEW go.* FILES") log.Info(repo.GetGoPath(), "GOING TO MAKE NEW go.* FILES")
// actually will re-create go.sum and go.mod now // actually will re-create go.sum and go.mod now
if _, err = repo.RunQuiet([]string{"go", "mod", "init", repo.GetGoPath()}); err != nil { os.Unsetenv("GO111MODULE")
if result, err := repo.RunQuiet([]string{"go", "mod", "init", repo.GetGoPath()}); err != nil {
log.Warn("go mod init failed", err) log.Warn("go mod init failed", err)
for _, line := range result.Stdout {
log.Warn("stdout:", line)
}
for _, line := range result.Stderr {
log.Warn("stderr:", line)
}
return err return err
} }
@ -69,9 +77,16 @@ func doStrict(repo *gitpb.Repo) error {
return err return err
} }
if _, err := repo.RunQuiet([]string{"go", "mod", "tidy", "-go=" + golangVersion}); err != nil { os.Unsetenv("GO111MODULE")
if result, err := repo.RunQuiet([]string{"go", "mod", "tidy", "-go=" + golangVersion}); err != nil {
// I guess the thing to do, if go mod tidy fails, is to just leave the repo alone // I guess the thing to do, if go mod tidy fails, is to just leave the repo alone
// it's either primitive or could be a go support project but not in go // it's either primitive or could be a go support project but not in go
for _, line := range result.Stdout {
log.Warn("stdout:", line)
}
for _, line := range result.Stderr {
log.Warn("stderr:", line)
}
return nil return nil
} }