remove attempts to set go version
This commit is contained in:
parent
4bbf8c76bc
commit
2b85f5e17d
|
@ -78,7 +78,7 @@ func doStrict(repo *gitpb.Repo) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
os.Unsetenv("GO111MODULE")
|
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
|
// 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 {
|
for _, line := range result.Stdout {
|
||||||
|
|
2
main.go
2
main.go
|
@ -17,8 +17,6 @@ var BUILDTIME string
|
||||||
// used for shell auto completion
|
// used for shell auto completion
|
||||||
var ARGNAME string = "go-mod-clean"
|
var ARGNAME string = "go-mod-clean"
|
||||||
|
|
||||||
var golangVersion string = "1.22"
|
|
||||||
|
|
||||||
var pp *arg.Parser
|
var pp *arg.Parser
|
||||||
var forge *forgepb.Forge
|
var forge *forgepb.Forge
|
||||||
|
|
||||||
|
|
33
redoGoMod.go
33
redoGoMod.go
|
@ -5,7 +5,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/go-cmd/cmd"
|
"github.com/go-cmd/cmd"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"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) {
|
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
|
return result, nil
|
||||||
} else {
|
} else {
|
||||||
return result, err
|
return result, err
|
||||||
|
@ -51,20 +50,6 @@ func redoGoMod(repo *gitpb.Repo) error {
|
||||||
return err
|
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
|
// parse the go.mod and go.sum files
|
||||||
if repo.ParseGoSum() {
|
if repo.ParseGoSum() {
|
||||||
return nil
|
return nil
|
||||||
|
@ -72,19 +57,3 @@ func redoGoMod(repo *gitpb.Repo) error {
|
||||||
|
|
||||||
return fmt.Errorf("check.ParseGoSum() failed")
|
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
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue