diff options
| author | Jeff Carr <[email protected]> | 2025-10-27 20:38:36 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-27 20:38:36 -0500 |
| commit | 1fe9716603d5aebc42e63228d9ade30e34ef085a (patch) | |
| tree | ef99316023ffc264fec27d4fec7a101561e36efe /doRebuild.go | |
| parent | 34ecc3bd69f5ed24f507b40c2c4ebc20328e7b05 (diff) | |
fixes for "forge rebuild forge"v0.25.104
Diffstat (limited to 'doRebuild.go')
| -rw-r--r-- | doRebuild.go | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/doRebuild.go b/doRebuild.go index 5aaa9d0..828ce5f 100644 --- a/doRebuild.go +++ b/doRebuild.go @@ -9,7 +9,9 @@ import ( "errors" "fmt" "os" + "path/filepath" + "go.wit.com/lib/env" "go.wit.com/lib/fhelp" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/argvpb" @@ -22,6 +24,10 @@ func doRebuild() (string, error) { var s string var err error + if env.AddPath(filepath.Join(env.Get("homeDir"), "go/bin")) { + // means the path wasn't there. TODO: warn the user + } + if ipv6fails() { // never returns if fail } @@ -35,14 +41,15 @@ func doRebuild() (string, error) { func doRebuildForge() (string, error) { var s string var err error - s, err = doRebuildPart1() + s, err = checkBuildRequirements() if err != nil { - log.Info("build Part1 failed", err) + log.Info("build requirements failed", err) s, err = doVerifyNamespace() if err != nil { log.Info("doVerifyNamespace() failed", err) return s, err } + return s, err } s, err = doRebuildPart2() if err != nil { @@ -64,7 +71,7 @@ func doRebuildForge() (string, error) { } // finally try 'make' in the forge sources - err = forge.RunVerbose([]string{"make"}) + err = forge.RunVerbose([]string{"make", "install-verbose"}) if err != nil { return "make failed", err } @@ -76,7 +83,8 @@ func doRebuildForge() (string, error) { return "done", nil } -func doRebuildPart1() (string, error) { +func checkBuildRequirements() (string, error) { + var allerr error log.Info("download here") if !fhelp.CheckProtoc() { } @@ -86,24 +94,42 @@ func doRebuildPart1() (string, error) { badExit(fmt.Errorf("you do not have 'protoc' installed")) } if path, err := fhelp.CheckCmd("goimports"); err != nil { - log.Info("go-clone missing", path, err) + log.Printf("goimports missing path(%s) err(%v)\n", path, err) cmd := []string{"go", "install", "-v", "-x", "golang.org/x/tools/cmd/goimports@latest"} - shell.RunRealtime(cmd) + log.Info("TRYING TO INSTALL goimports", cmd) + log.Info("TRYING TO INSTALL goimports", cmd) + log.Info("TRYING TO INSTALL goimports", cmd) + log.Info("TRYING TO INSTALL goimports", cmd) + shell.RunVerboseOnError(cmd) + allerr = errors.Join(allerr, err) + } else { + log.Info("goimports at path:", path) } if path, err := fhelp.CheckCmd("go-clone"); err != nil { - log.Info("go-clone missing", path, err) + log.Printf("go-clone missing path(%s) err(%v)\n", path, err) cmd := []string{"go", "install", "-v", "-x", "go.wit.com/apps/go-clone@latest"} shell.RunRealtime(cmd) + allerr = errors.Join(allerr, err) + } else { + log.Info("go-clone at path:", path) } - if _, err := fhelp.CheckCmd("autogenpb"); err != nil { + if path, err := fhelp.CheckCmd("autogenpb"); err != nil { + log.Printf("autogenpb missing path(%s) err(%v)\n", path, err) cmd := []string{"go", "install", "-v", "-x", "go.wit.com/apps/autogenpb@latest"} shell.RunRealtime(cmd) + allerr = errors.Join(allerr, err) + } else { + log.Info("autogenpb at path:", path) } - if _, err := fhelp.CheckCmd("go-mod-clean"); err != nil { + if path, err := fhelp.CheckCmd("go-mod-clean"); err != nil { + log.Printf("go-mod-clean missing path(%s) err(%v)\n", path, err) cmd := []string{"go", "install", "-v", "-x", "go.wit.com/apps/go-mod-clean@latest"} shell.RunRealtime(cmd) + allerr = errors.Join(allerr, err) + } else { + log.Info("go-mod-clean at path:", path) } - return "part1", errors.New("probably failed. notsure") + return "part1", allerr } func doRebuildPart2() (string, error) { |
