moving go.mod handling here
This commit is contained in:
parent
5d28c6741a
commit
3de739288b
|
@ -16,7 +16,7 @@ import (
|
||||||
// repos you can also type "make redomod" to do the same thing
|
// 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
|
// since it's a Makefile task that is also useful to be able to run
|
||||||
// from the command line
|
// 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
|
// unset the go development ENV var to generate release files
|
||||||
os.Unsetenv("GO111MODULE")
|
os.Unsetenv("GO111MODULE")
|
||||||
if ok, err := repo.strictRun([]string{"rm", "-f", "go.mod", "go.sum"}); !ok {
|
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
|
return ok, err
|
||||||
}
|
}
|
||||||
// most things should build with golang after 1.20
|
// 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 {
|
if ok, err := repo.strictRun([]string{"go", "mod", "edit", "-go=1.20"}); !ok {
|
||||||
log.Warn("go mod edit failed", err)
|
log.Warn("go mod edit failed", err)
|
||||||
return ok, err
|
return ok, err
|
||||||
}
|
}
|
||||||
log.Info("MakeRedomod() worked", repo.GoPath)
|
// log.Info("MakeRedomod() worked", repo.GoPath)
|
||||||
|
|
||||||
if repo.Exists("go.sum") {
|
if repo.Exists("go.sum") {
|
||||||
// return the attempt to parse go.mod & go.sum
|
// return the attempt to parse go.mod & go.sum
|
||||||
|
@ -89,6 +88,9 @@ func (repo *Repo) parseGoSum() (bool, error) {
|
||||||
GoPath: godep,
|
GoPath: godep,
|
||||||
Version: version,
|
Version: version,
|
||||||
}
|
}
|
||||||
|
if repo.GoDeps == nil {
|
||||||
|
repo.GoDeps = new(GoDeps)
|
||||||
|
}
|
||||||
repo.GoDeps.AppendUniqueGoPath(&new1)
|
repo.GoDeps.AppendUniqueGoPath(&new1)
|
||||||
/*
|
/*
|
||||||
found := repo.FindGoDepByPath(godep)
|
found := repo.FindGoDepByPath(godep)
|
||||||
|
|
2
shell.go
2
shell.go
|
@ -36,7 +36,7 @@ func (repo *Repo) RunQuiet(cmd []string) cmd.Status {
|
||||||
|
|
||||||
// for now, even check cmd.Exit
|
// for now, even check cmd.Exit
|
||||||
func (repo *Repo) strictRun(cmd []string) (bool, error) {
|
func (repo *Repo) strictRun(cmd []string) (bool, error) {
|
||||||
result := repo.Run(cmd)
|
result := repo.RunQuiet(cmd)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
log.Warn("go mod init failed err:", result.Error)
|
log.Warn("go mod init failed err:", result.Error)
|
||||||
return false, result.Error
|
return false, result.Error
|
||||||
|
|
Loading…
Reference in New Issue