From 26dbbf9ddacd82601888cd518876dd6581a916d8 Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 11:57:12 -0700 Subject: [PATCH 1/6] Remove commands don't like asterisks --- cmd/meroxa/root/apps/deploy.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index e74cbd543..1dee65b3c 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -24,6 +24,7 @@ import ( "io" "net/http" "os" + "os/exec" "path" "path/filepath" "strings" @@ -546,9 +547,16 @@ func (d *Deploy) prepareAppForDeployment(ctx context.Context) error { func (d *Deploy) rmBinary() { if d.lang == GoLang { - err := os.Remove(filepath.Join(d.path, d.appName+"*")) + cmd := exec.Command("rm", filepath.Join(d.path, d.appName)) + _, err := cmd.CombinedOutput() if err != nil { - fmt.Printf("warning: failed to clean up app at %s: %v\n", d.path, err) + fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName), d.path) + } + + cmd = exec.Command("rm", filepath.Join(d.path, d.appName)+".cross") + _, err = cmd.CombinedOutput() + if err != nil { + fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName)+".cross", d.path) } } } From 4d48667ba9e6408fe661d96ca84dc3b48949e1c2 Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 12:34:46 -0700 Subject: [PATCH 2/6] lint --- cmd/meroxa/root/apps/deploy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index 1dee65b3c..80a5d6874 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -547,13 +547,13 @@ func (d *Deploy) prepareAppForDeployment(ctx context.Context) error { func (d *Deploy) rmBinary() { if d.lang == GoLang { - cmd := exec.Command("rm", filepath.Join(d.path, d.appName)) + cmd := exec.Command("rm", filepath.Join(d.path, d.appName)) //nolint:gosec _, err := cmd.CombinedOutput() if err != nil { fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName), d.path) } - cmd = exec.Command("rm", filepath.Join(d.path, d.appName)+".cross") + cmd = exec.Command("rm", filepath.Join(d.path, d.appName)+".cross") //nolint:gosec _, err = cmd.CombinedOutput() if err != nil { fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName)+".cross", d.path) From 7154fea8bd9153f000bcb58ba9087ddd04594f03 Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 14:40:14 -0700 Subject: [PATCH 3/6] perhaps a little easier to read --- cmd/meroxa/root/apps/deploy.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index 80a5d6874..fe2e75228 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -24,7 +24,6 @@ import ( "io" "net/http" "os" - "os/exec" "path" "path/filepath" "strings" @@ -547,16 +546,16 @@ func (d *Deploy) prepareAppForDeployment(ctx context.Context) error { func (d *Deploy) rmBinary() { if d.lang == GoLang { - cmd := exec.Command("rm", filepath.Join(d.path, d.appName)) //nolint:gosec - _, err := cmd.CombinedOutput() + localBinary := filepath.Join(d.path, d.appName) + err := os.Remove(localBinary) //nolint:gosec if err != nil { - fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName), d.path) + fmt.Printf("warning: failed to clean up %s at %s\n", localBinary, d.path) } - cmd = exec.Command("rm", filepath.Join(d.path, d.appName)+".cross") //nolint:gosec - _, err = cmd.CombinedOutput() + crossCompiledBinary := filepath.Join(d.path, d.appName) + ".cross" + err = os.Remove(crossCompiledBinary) //nolint:gosec if err != nil { - fmt.Printf("warning: failed to clean up %s at %s\n", filepath.Join(d.path, d.appName)+".cross", d.path) + fmt.Printf("warning: failed to clean up %s at %s\n", crossCompiledBinary, d.path) } } } From 85a63914a00ca6dda07d566a9703244f7d6d1234 Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 14:41:55 -0700 Subject: [PATCH 4/6] lint --- cmd/meroxa/root/apps/deploy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index fe2e75228..64e9ae5a3 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -547,13 +547,13 @@ func (d *Deploy) prepareAppForDeployment(ctx context.Context) error { func (d *Deploy) rmBinary() { if d.lang == GoLang { localBinary := filepath.Join(d.path, d.appName) - err := os.Remove(localBinary) //nolint:gosec + err := os.Remove(localBinary) if err != nil { fmt.Printf("warning: failed to clean up %s at %s\n", localBinary, d.path) } crossCompiledBinary := filepath.Join(d.path, d.appName) + ".cross" - err = os.Remove(crossCompiledBinary) //nolint:gosec + err = os.Remove(crossCompiledBinary) if err != nil { fmt.Printf("warning: failed to clean up %s at %s\n", crossCompiledBinary, d.path) } From 68e7b000ebbcafa512f3da66f155cc4d2491212e Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 14:42:49 -0700 Subject: [PATCH 5/6] clean up log --- cmd/meroxa/root/apps/deploy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index 64e9ae5a3..f7df9f636 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -549,13 +549,13 @@ func (d *Deploy) rmBinary() { localBinary := filepath.Join(d.path, d.appName) err := os.Remove(localBinary) if err != nil { - fmt.Printf("warning: failed to clean up %s at %s\n", localBinary, d.path) + fmt.Printf("warning: failed to clean up %s\n", localBinary) } crossCompiledBinary := filepath.Join(d.path, d.appName) + ".cross" err = os.Remove(crossCompiledBinary) if err != nil { - fmt.Printf("warning: failed to clean up %s at %s\n", crossCompiledBinary, d.path) + fmt.Printf("warning: failed to clean up %s\n", crossCompiledBinary) } } } From 5a1f2443590e9b240749e37fbd231aa46b9ce09e Mon Sep 17 00:00:00 2001 From: janelletavares Date: Mon, 18 Apr 2022 15:15:12 -0700 Subject: [PATCH 6/6] sneaking in a formatting change for consistency --- cmd/meroxa/root/apps/deploy.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/meroxa/root/apps/deploy.go b/cmd/meroxa/root/apps/deploy.go index f7df9f636..0dc90f77b 100644 --- a/cmd/meroxa/root/apps/deploy.go +++ b/cmd/meroxa/root/apps/deploy.go @@ -367,7 +367,7 @@ func (d *Deploy) getPlatformImage(ctx context.Context, appPath string) (string, d.logger.StopSpinnerWithStatus("\t", log.Failed) return "", err } - d.logger.StartSpinner("\t", fmt.Sprintf(" Building Meroxa Process image (%s)...", build.Uuid)) + d.logger.StartSpinner("\t", fmt.Sprintf(" Building Meroxa Process image (%q)...", build.Uuid)) for { b, err := d.client.GetBuild(ctx, build.Uuid) @@ -382,7 +382,7 @@ func (d *Deploy) getPlatformImage(ctx context.Context, appPath string) (string, d.logger.StopSpinnerWithStatus(msg, log.Failed) return "", fmt.Errorf("build with uuid %q errored", b.Uuid) case "complete": - d.logger.StopSpinnerWithStatus(fmt.Sprintf("Successfully built Process image! (%s)", build.Uuid), log.Successful) + d.logger.StopSpinnerWithStatus(fmt.Sprintf("Successfully built Process image! (%q)", build.Uuid), log.Successful) return build.Image, nil } time.Sleep(pollDuration)