summaryrefslogtreecommitdiff
path: root/doRebuild.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-29 14:15:07 -0500
committerJeff Carr <[email protected]>2025-10-29 14:15:07 -0500
commitd3c0922f35dc78008e21065755fdcf622fc32869 (patch)
tree4c46bab3ec9a15daf824c5e34bf600749bd71be1 /doRebuild.go
parentfe20a82a0af45285d551fdacde53d3ed053d4022 (diff)
change paths to /usr/lib/pluginsv0.25.106
Diffstat (limited to 'doRebuild.go')
-rw-r--r--doRebuild.go51
1 files changed, 43 insertions, 8 deletions
diff --git a/doRebuild.go b/doRebuild.go
index 828ce5f..4a8738d 100644
--- a/doRebuild.go
+++ b/doRebuild.go
@@ -93,6 +93,19 @@ func checkBuildRequirements() (string, error) {
if !fhelp.CheckProtoc() {
badExit(fmt.Errorf("you do not have 'protoc' installed"))
}
+ if path, err := fhelp.CheckCmd("go-clone"); err != nil {
+ 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 msg, err := doClone("golang.org/x/tools"); err == nil {
+ // cloned okay
+ } else {
+ return msg, err
+ }
if path, err := fhelp.CheckCmd("goimports"); err != nil {
log.Printf("goimports missing path(%s) err(%v)\n", path, err)
cmd := []string{"go", "install", "-v", "-x", "golang.org/x/tools/cmd/goimports@latest"}
@@ -105,14 +118,6 @@ func checkBuildRequirements() (string, error) {
} else {
log.Info("goimports at path:", path)
}
- if path, err := fhelp.CheckCmd("go-clone"); err != nil {
- 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 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"}
@@ -132,6 +137,36 @@ func checkBuildRequirements() (string, error) {
return "part1", allerr
}
+func doClone(namespace string) (string, error) {
+ if path, err := fhelp.CheckCmd("go-clone"); err != nil {
+ pfile, _ := resources.ReadFile("resources/GOPATH")
+ log.Info("")
+ log.Info(string(pfile))
+ log.Info("may be at:", path)
+ s := fmt.Sprintf("setup PATH")
+ return s, errors.New("prep build failed")
+ }
+ var basecmd []string
+ var cmd []string
+ if me.forge.IsGoWork() {
+ log.Info("Using go.work directory")
+ basecmd = []string{"go-clone", "--work", "--repo"}
+ } else {
+ basecmd = []string{"go-clone", "--repo"}
+ }
+ // log.Info("Running:", cmd)
+ // shell.RunRealtime(cmd)
+
+ cmd = append(basecmd, namespace)
+ log.Info("Running:", cmd)
+ r := shell.RunRealtime(cmd)
+ if r.Error != nil {
+ return "download go-mod-clean failed", r.Error
+ }
+ doVerifyNamespace()
+ return "cloned " + namespace, nil
+}
+
func doRebuildPart2() (string, error) {
if path, err := fhelp.CheckCmd("go-clone"); err != nil {
pfile, _ := resources.ReadFile("resources/GOPATH")