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 | |
| parent | 34ecc3bd69f5ed24f507b40c2c4ebc20328e7b05 (diff) | |
fixes for "forge rebuild forge"v0.25.104
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | complete.go | 8 | ||||
| -rw-r--r-- | doFix.go | 2 | ||||
| -rw-r--r-- | doNewUser.go | 1 | ||||
| -rw-r--r-- | doNormal.go | 1 | ||||
| -rw-r--r-- | doRebuild.go | 46 |
6 files changed, 43 insertions, 19 deletions
@@ -33,12 +33,12 @@ build: goimports vet plugin GO111MODULE=off go build \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -install: goimports plugin +install: goimports vet plugin GO111MODULE=off go install \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" cp -f ~/go/bin/forge ~/go/bin/last.forge # this is a hack so that go-deb can build a .deb file for forge # TODO: remove this -install-verbose: goimports vet plugin +install-verbose: goimports GO111MODULE=off go install -v -x \ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" diff --git a/complete.go b/complete.go index bbc214e..3832308 100644 --- a/complete.go +++ b/complete.go @@ -121,18 +121,18 @@ func (a args) DoAutoComplete() error { } if argvpb.PB.IsMatch("cache") { matches, _ := matchCacheFiles() - fmt.Fprintf(argvpb.Stdout, matches) + fmt.Fprintf(argvpb.Stdout, "%s", matches) return nil } if argvpb.PB.IsMatch("mode.--config") { matches, _ := matchModeDirs() - fmt.Fprintf(argvpb.Stdout, matches) + fmt.Fprintf(argvpb.Stdout, "%s", matches) return nil } if argvpb.PB.IsMatch("mode") { err = me.pp.WriteHelpForAutocomplete("", "mode") matches := []string{"jwc", "false"} - fmt.Fprintf(argvpb.Stdout, " "+strings.Join(matches, " ")) + fmt.Fprintf(argvpb.Stdout, "%s", " "+strings.Join(matches, " ")) return nil } if argvpb.PB.GetCmd() == "" { @@ -140,7 +140,7 @@ func (a args) DoAutoComplete() error { matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild", "generate", "config", "cache"} matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged") matches = append(matches, "--version", "--force", "--all", "--verbose") - fmt.Fprintf(argvpb.Stdout, strings.Join(matches, " ")) + fmt.Fprintf(argvpb.Stdout, "%s", strings.Join(matches, " ")) return nil } err = me.pp.WriteHelpForAutocomplete(argvpb.PB.Partial, argvpb.PB.Real...) @@ -93,7 +93,7 @@ func doRemoveUntrackedFiles() (string, error) { } footer := found.PrintDefaultTB() log.Info(footer) - log.Info("You have %d files that are untracked excluded git files. They are probably junk.", count) + log.Printf("You have %d files that are untracked excluded git files. They are probably junk.\n", count) log.Info("") log.Info("You can remove these files with '--fix' or list them all with '--verbose'") log.Info("") diff --git a/doNewUser.go b/doNewUser.go index 035e7ba..5eecd6b 100644 --- a/doNewUser.go +++ b/doNewUser.go @@ -30,7 +30,6 @@ func doNewUser() (string, error) { } if !me.forge.IsModeNewUser() { - panic("finally got out of NEWUSER") // you aren't a new user anymore return s, err } diff --git a/doNormal.go b/doNormal.go index a1e2b04..aed713a 100644 --- a/doNormal.go +++ b/doNormal.go @@ -53,7 +53,6 @@ func doNormalAll() (string, error) { func (a *args) DoNormal() (string, error) { env.Set("modeDir", "jwc") env.Save() - panic("donormal. yay") return doNormalAttempt() } 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) { |
