From 81d48668a58fe6a401dedef61519bd089454f273 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2020 18:46:31 +0000 Subject: [PATCH 1/2] Format code with Go fmt --- commands/pipeline_status.go | 14 +++++++------- commands/pipeline_view.go | 14 +++++++------- internal/browser/browser.go | 2 +- internal/git/git.go | 3 ++- internal/manip/utils.go | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/commands/pipeline_status.go b/commands/pipeline_status.go index e74374d8..bb1ca416 100644 --- a/commands/pipeline_status.go +++ b/commands/pipeline_status.go @@ -14,8 +14,8 @@ import ( ) var pipelineStatusCmd = &cobra.Command{ - Use: "status [flags]", - Short: `Check the status of a single pipeline`, + Use: "status [flags]", + Short: `Check the status of a single pipeline`, Aliases: []string{"stats"}, Example: heredoc.Doc(` $ glab pipeline status 177883 @@ -39,9 +39,9 @@ var pipelineStatusCmd = &cobra.Command{ } } l := &gitlab.ListProjectPipelinesOptions{ - Ref: gitlab.String(branch), + Ref: gitlab.String(branch), OrderBy: gitlab.String("updated_at"), - Sort: gitlab.String("desc"), + Sort: gitlab.String("desc"), } l.Page = 1 l.PerPage = 1 @@ -63,7 +63,7 @@ var pipelineStatusCmd = &cobra.Command{ for _, job := range jobs { duration := fmtDuration(job.Duration) var status string - switch s:=job.Status; s { + switch s := job.Status; s { case "failed": status = color.Red.Sprint(s) case "success": @@ -117,7 +117,7 @@ func retryPipelineJob(pid int) *gitlab.Pipeline { func fmtDuration(duration float64) string { s := math.Mod(duration, 60) - m := (duration-s)/60 + m := (duration - s) / 60 s = math.Round(s) return fmt.Sprintf("%02vm %02vs", m, s) } @@ -144,4 +144,4 @@ func init() { pipelineStatusCmd.Flags().BoolP("live", "l", false, "Show status in realtime till pipeline ends") pipelineStatusCmd.Flags().StringP("branch", "b", "", "Check pipeline status for a branch. (Default is current branch)") pipelineCmd.AddCommand(pipelineStatusCmd) -} \ No newline at end of file +} diff --git a/commands/pipeline_view.go b/commands/pipeline_view.go index feba462a..7e8f865d 100644 --- a/commands/pipeline_view.go +++ b/commands/pipeline_view.go @@ -28,7 +28,7 @@ var pipelineDetails *gitlab.Pipeline var pipelineJobDetails []*gitlab.Job var mainView *gocui.View -func getPipelineJobs(pid int) []*gitlab.Job { +func getPipelineJobs(pid int) []*gitlab.Job { gitlabClient, repo := git.InitGitlabClient() l := &gitlab.ListJobsOptions{} pipeJobs, _, err := gitlabClient.Jobs.ListPipelineJobs(repo, pid, l) @@ -171,10 +171,10 @@ func keybindings(g *gocui.Gui) error { return err } /* - if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, getLine); err != nil { - return err - } - */ + if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, getLine); err != nil { + return err + } + */ if err := g.SetKeybinding("side", gocui.KeyEnter, gocui.ModNone, showLoading); err != nil { return err } @@ -269,7 +269,7 @@ func displayPipelineJobLog(g *gocui.Gui, jid int, maxX, maxY int) error { return nil } -func updatePipelineLog(v *gocui.View, jid int) { +func updatePipelineLog(v *gocui.View, jid int) { var str string if b, err := ioutil.ReadAll(getPipelineJobLog(jid)); err == nil { str = string(b) @@ -281,4 +281,4 @@ func updatePipelineLog(v *gocui.View, jid int) { func init() { pipelineCmd.AddCommand(pipelineViewCmd) -} \ No newline at end of file +} diff --git a/internal/browser/browser.go b/internal/browser/browser.go index 79babfcc..67ebca92 100644 --- a/internal/browser/browser.go +++ b/internal/browser/browser.go @@ -50,4 +50,4 @@ func FromLauncher(launcher, url string) (*exec.Cmd, error) { cmd := exec.Command(args[0], args[1:]...) cmd.Stderr = os.Stderr return cmd, nil -} \ No newline at end of file +} diff --git a/internal/git/git.go b/internal/git/git.go index cb30a96c..7285aaef 100644 --- a/internal/git/git.go +++ b/internal/git/git.go @@ -36,7 +36,7 @@ func GetRemoteURL() string { } func GetRemoteBaseURL() string { - return strings.TrimSuffix(strings.ReplaceAll(GetRemoteURL(), GetRepo(), ""),".git") + return strings.TrimSuffix(strings.ReplaceAll(GetRemoteURL(), GetRepo(), ""), ".git") } // getRepoNameWithNamespace returns the the repo with its namespace (like profclems/glab). Respects group and subgroups names @@ -65,6 +65,7 @@ func getRepoNameWithNamespace(remoteURL string) (string, error) { // HasHub is true if hub binary is installed var HasHub bool + // HasGH is true is GitHub Cli is installed var HasGH bool diff --git a/internal/manip/utils.go b/internal/manip/utils.go index 609d09a0..4fbe425c 100644 --- a/internal/manip/utils.go +++ b/internal/manip/utils.go @@ -98,4 +98,4 @@ func DisplayURL(urlStr string) string { func GreenCheck() string { return color.Green.Sprintf("✓") -} \ No newline at end of file +} From 38f4e742a5ed5f55d113a9e6d9c9f23fefb51c70 Mon Sep 17 00:00:00 2001 From: Clement Sam Date: Wed, 12 Aug 2020 08:14:32 +0000 Subject: [PATCH 2/2] Delete log.txt --- log.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 log.txt diff --git a/log.txt b/log.txt deleted file mode 100644 index e572b044..00000000 --- a/log.txt +++ /dev/null @@ -1 +0,0 @@ -2020/08/10 07:08:52 Micro started