From 84b4b68ef273b1d1265da4ca4058cfd5ce88abcd Mon Sep 17 00:00:00 2001 From: Clement Sam Date: Thu, 13 Aug 2020 02:24:06 +0000 Subject: [PATCH] fix: Fixed bug risks and antipatterns --- commands/pipeline_ci_trace.go | 2 +- commands/pipeline_status.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/commands/pipeline_ci_trace.go b/commands/pipeline_ci_trace.go index 99ae05b4..b49efdf1 100644 --- a/commands/pipeline_ci_trace.go +++ b/commands/pipeline_ci_trace.go @@ -75,7 +75,7 @@ var pipelineCITraceCmd = &cobra.Command{ Message: "Select pipeline job to trace:", Options: jobOptions, } - survey.AskOne(prompt, &selectedJob) + _ = survey.AskOne(prompt, &selectedJob) if selectedJob != "" { re := regexp.MustCompile(`(?s)\((.*)\)`) m := re.FindAllStringSubmatch(selectedJob,-1) diff --git a/commands/pipeline_status.go b/commands/pipeline_status.go index 1eee571a..78ea05aa 100644 --- a/commands/pipeline_status.go +++ b/commands/pipeline_status.go @@ -9,7 +9,6 @@ import ( "github.com/spf13/cobra" "github.com/xanzy/go-gitlab" "glab/internal/git" - "math" "strconv" "time" ) @@ -73,12 +72,12 @@ var pipelineStatusCmd = &cobra.Command{ status = color.Gray.Sprint(s) } //fmt.Println(job.Tag) - fmt.Fprintf(writer, "(%s) • %s\t\t%s\t\t%s\n", status, duration, job.Stage, job.Name) + _, _ = fmt.Fprintf(writer, "(%s) • %s\t\t%s\t\t%s\n", status, duration, job.Stage, job.Name) } - fmt.Fprintf(writer.Newline(), "\n%s\n", runningPipeline.WebURL) - fmt.Fprintf(writer.Newline(), "SHA: %s\n", runningPipeline.SHA) - fmt.Fprintf(writer.Newline(), "Pipeline State: %s\n", runningPipeline.Status) + _, _ = fmt.Fprintf(writer.Newline(), "\n%s\n", runningPipeline.WebURL) + _, _ = fmt.Fprintf(writer.Newline(), "SHA: %s\n", runningPipeline.SHA) + _, _ = fmt.Fprintf(writer.Newline(), "Pipeline State: %s\n", runningPipeline.Status) if runningPipeline.Status == "running" && live { pipes, err = getPipelines(l) if err != nil { @@ -92,7 +91,7 @@ var pipelineStatusCmd = &cobra.Command{ Options: []string{"View Logs", "Retry", "Exit"}, Default: "Exit", } - survey.AskOne(prompt, &retry) + _ = survey.AskOne(prompt, &retry) } if retry != "" && retry != "Exit" { if retry == "View Logs" {