remove attempts to set go version

This commit is contained in:
Jeff Carr 2025-05-23 17:40:23 -05:00
parent 4bbf8c76bc
commit 2b85f5e17d
3 changed files with 2 additions and 35 deletions

View File

@ -78,7 +78,7 @@ func doStrict(repo *gitpb.Repo) error {
}
os.Unsetenv("GO111MODULE")
if result, err := repo.RunQuiet([]string{"go", "mod", "tidy", "-go=" + golangVersion}); err != nil {
if result, err := repo.RunQuiet([]string{"go", "mod", "tidy"}); err != nil {
// 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
for _, line := range result.Stdout {

View File

@ -17,8 +17,6 @@ var BUILDTIME string
// used for shell auto completion
var ARGNAME string = "go-mod-clean"
var golangVersion string = "1.22"
var pp *arg.Parser
var forge *forgepb.Forge

View File

@ -5,7 +5,6 @@ package main
import (
"fmt"
"os"
"strings"
"github.com/go-cmd/cmd"
"go.wit.com/lib/protobuf/gitpb"
@ -31,7 +30,7 @@ func setGoVersion(repo *gitpb.Repo, version string) error {
}
func goTidy(fullpath string) (cmd.Status, error) {
if result, err := runVerbose(fullpath, []string{"go", "mod", "tidy", "-go=" + golangVersion}); err == nil {
if result, err := runVerbose(fullpath, []string{"go", "mod", "tidy"}); err == nil {
return result, nil
} else {
return result, err
@ -51,20 +50,6 @@ func redoGoMod(repo *gitpb.Repo) error {
return err
}
if result, err := goTidy(repo.FullPath); err != nil {
if tinyFixer(result) {
if _, err := goTidy(repo.FullPath); err != nil {
return err
}
}
}
// most things should build with golang after 1.21 // todo: allow this to be set somewhere
if err := setGoVersion(repo, golangVersion); err != nil {
log.Warn(repo.GetGoPath(), "go mod edit failed", err)
return err
}
// parse the go.mod and go.sum files
if repo.ParseGoSum() {
return nil
@ -72,19 +57,3 @@ func redoGoMod(repo *gitpb.Repo) error {
return fmt.Errorf("check.ParseGoSum() failed")
}
func tinyFixer(result cmd.Status) bool {
for _, line := range result.Stdout {
if strings.Contains(line, "requires go@") {
log.Info("tinyFixer:", line)
parts := strings.Split(line, "requires go@")
if len(parts) == 2 {
parts = strings.Split(parts[1], ",")
golangVersion = parts[0]
return true
}
log.Info("tinyFixer:", line, "golangVersion", golangVersion)
}
}
return false
}