Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Format code with Go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] authored Aug 9, 2020
1 parent 0c56135 commit 557e209
Show file tree
Hide file tree
Showing 36 changed files with 148 additions and 150 deletions.
2 changes: 1 addition & 1 deletion cmd/glab/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ func main() {
fmt.Println(err)
os.Exit(1)
}
}
}
4 changes: 2 additions & 2 deletions commands/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func displayAllIssues(m []*gitlab.Issue) {
for _, issue := range m {
var labels string
for _, l := range issue.Labels {
labels+=" "+l+","
labels += " " + l + ","
}
labels = strings.Trim(labels, ", ")
duration := manip.TimeAgo(*issue.CreatedAt)
Expand Down Expand Up @@ -58,7 +58,7 @@ var issueCmd = &cobra.Command{
Short: `Create, view and manage remote issues`,
Long: ``,
Run: func(cmd *cobra.Command, args []string) {
if len(args)==0 || len(args) > 2 {
if len(args) == 0 || len(args) > 2 {
cmd.Help()
return
}
Expand Down
2 changes: 1 addition & 1 deletion commands/issue_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ var issueCloseCmd = &cobra.Command{

func init() {
issueCmd.AddCommand(issueCloseCmd)
}
}
10 changes: 5 additions & 5 deletions commands/issue_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

var issueCreateCmd = &cobra.Command{
Use: "create [flags]",
Short: `Create an issue`,
Long: ``,
Use: "create [flags]",
Short: `Create an issue`,
Long: ``,
Aliases: []string{"new"},
Run: func(cmd *cobra.Command, args []string) {
if len(args) > 0 {
Expand All @@ -28,7 +28,7 @@ var issueCreateCmd = &cobra.Command{
if title, _ := cmd.Flags().GetString("title"); title != "" {
issueTitle = strings.Trim(title, " ")
} else {
issueTitle = manip.AskQuestionWithInput("Title","", true)
issueTitle = manip.AskQuestionWithInput("Title", "", true)
}
if label, _ := cmd.Flags().GetString("label"); label != "" {
issueLabel = strings.Trim(label, "[] ")
Expand Down Expand Up @@ -86,4 +86,4 @@ func init() {
issueCreateCmd.Flags().BoolP("allow-collaboration", "", false, "Allow collaboration")
issueCreateCmd.Flags().BoolP("remove-source-branch", "", false, "Remove Source Branch after merge")
issueCmd.AddCommand(issueCreateCmd)
}
}
2 changes: 1 addition & 1 deletion commands/issue_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ var issueDeleteCmd = &cobra.Command{

func init() {
issueCmd.AddCommand(issueDeleteCmd)
}
}
10 changes: 5 additions & 5 deletions commands/issue_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ var issueListCmd = &cobra.Command{
Args: cobra.MaximumNArgs(3),
Run: func(cmd *cobra.Command, args []string) {
var state string
if lb, _ := cmd.Flags().GetBool("all"); lb {
if lb, _ := cmd.Flags().GetBool("all"); lb {
state = "all"
} else if lb, _ := cmd.Flags().GetBool("closed"); lb {
} else if lb, _ := cmd.Flags().GetBool("closed"); lb {
state = "closed"
} else {
state = "opened"
Expand All @@ -26,16 +26,16 @@ var issueListCmd = &cobra.Command{
l := &gitlab.ListProjectIssuesOptions{
State: gitlab.String(state),
}
if lb, _ := cmd.Flags().GetString("label"); lb != "" {
if lb, _ := cmd.Flags().GetString("label"); lb != "" {
label := gitlab.Labels{
lb,
}
l.Labels = label
}
if lb, _ := cmd.Flags().GetString("milestone"); lb != "" {
if lb, _ := cmd.Flags().GetString("milestone"); lb != "" {
l.Milestone = gitlab.String(lb)
}
if lb, _ := cmd.Flags().GetBool("confidential"); lb {
if lb, _ := cmd.Flags().GetBool("confidential"); lb {
l.Confidential = gitlab.Bool(lb)
}

Expand Down
2 changes: 1 addition & 1 deletion commands/issue_reopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ var issueReopenCmd = &cobra.Command{

func init() {
issueCmd.AddCommand(issueReopenCmd)
}
}
4 changes: 2 additions & 2 deletions commands/issue_subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var issueSubscribeCmd = &cobra.Command{
} else if resp.StatusCode == 404 {
er("Issue does not exist")
} else {
er("Could not complete request; "+ resp.Status)
er("Could not complete request; " + resp.Status)
}
}
} else {
Expand All @@ -43,4 +43,4 @@ var issueSubscribeCmd = &cobra.Command{

func init() {
issueCmd.AddCommand(issueSubscribeCmd)
}
}
2 changes: 1 addition & 1 deletion commands/issue_unsubscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ var issueUnsubscribeCmd = &cobra.Command{

func init() {
issueCmd.AddCommand(issueUnsubscribeCmd)
}
}
2 changes: 1 addition & 1 deletion commands/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ var labelCmd = &cobra.Command{

func init() {
RootCmd.AddCommand(labelCmd)
}
}
13 changes: 6 additions & 7 deletions commands/label_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ import (
"glab/internal/git"
)


var labelCreateCmd = &cobra.Command{
Use: "create <id> [flags]",
Short: `Create labels for repository/project`,
Long: ``,
Use: "create <id> [flags]",
Short: `Create labels for repository/project`,
Long: ``,
Aliases: []string{"new"},
Args: cobra.MaximumNArgs(1),
Run: createLabel,
Run: createLabel,
}

func createLabel (cmd *cobra.Command, args []string) {
func createLabel(cmd *cobra.Command, args []string) {

gitlabClient, repo := git.InitGitlabClient()
l := &gitlab.CreateLabelOptions{}
Expand Down Expand Up @@ -51,4 +50,4 @@ func init() {
labelCreateCmd.Flags().StringP("color", "c", "#428BCA", "Color of label in plain or HEX code. (Default: #428BCA)")
labelCreateCmd.Flags().StringP("description", "d", "", "Label description")
labelCmd.AddCommand(labelCreateCmd)
}
}
12 changes: 6 additions & 6 deletions commands/label_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import (
)

var labelListCmd = &cobra.Command{
Use: "list <id> [flags]",
Short: `List labels in repository`,
Long: ``,
Use: "list <id> [flags]",
Short: `List labels in repository`,
Long: ``,
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Run: listLabels,
Run: listLabels,
}

func listLabels(cmd *cobra.Command, args []string) {
Expand All @@ -27,10 +27,10 @@ func listLabels(cmd *cobra.Command, args []string) {
fmt.Printf("Showing label %d of %d on %s", len(labels), len(labels), repo)
fmt.Println()
for _, label := range labels {
color.HEX(strings.Trim(label.Color, "#")).Printf("#%d %s\n",label.ID, label.Name)
color.HEX(strings.Trim(label.Color, "#")).Printf("#%d %s\n", label.ID, label.Name)
}
}

func init() {
labelCmd.AddCommand(labelListCmd)
}
}
2 changes: 1 addition & 1 deletion commands/mr.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ var mrCmd = &cobra.Command{

func init() {
RootCmd.AddCommand(mrCmd)
}
}
10 changes: 5 additions & 5 deletions commands/mr_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import (
)

var mrApproveCmd = &cobra.Command{
Use: "approve <id> [flags]",
Short: `Approve merge requests`,
Long: ``,
Use: "approve <id> [flags]",
Short: `Approve merge requests`,
Long: ``,
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Run: approveMergeRequest,
Run: approveMergeRequest,
}

func approveMergeRequest(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -56,4 +56,4 @@ func init() {
mrApproveCmd.Flags().StringP("sha", "s", "", "The HEAD of the merge request")
//mrApproveCmd.Flags().StringP("password", "p", "", "Current user’s password. Required if 'Require user password to approve' is enabled in the project settings.")
mrCmd.AddCommand(mrApproveCmd)
}
}
2 changes: 1 addition & 1 deletion commands/mr_browse.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ var mrBrowseCmd = &cobra.Command{

func init() {
mrCmd.AddCommand(mrBrowseCmd)
}
}
10 changes: 5 additions & 5 deletions commands/mr_close.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
)

var mrCloseCmd = &cobra.Command{
Use: "close <id>",
Short: `Close merge requests`,
Long: ``,
Use: "close <id>",
Short: `Close merge requests`,
Long: ``,
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(1),
Run: closeMergeRequestState,
Run: closeMergeRequestState,
}

func closeMergeRequestState(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -45,4 +45,4 @@ func closeMergeRequestState(cmd *cobra.Command, args []string) {

func init() {
mrCmd.AddCommand(mrCloseCmd)
}
}
8 changes: 4 additions & 4 deletions commands/mr_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
)

var mrCreateCmd = &cobra.Command{
Use: "create",
Short: `Create new merge request`,
Long: ``,
Use: "create",
Short: `Create new merge request`,
Long: ``,
Aliases: []string{"new"},
Run: func(cmd *cobra.Command, args []string) {
if len(args) > 0 {
Expand Down Expand Up @@ -119,4 +119,4 @@ func init() {
mrCreateCmd.Flags().BoolP("allow-collaboration", "", false, "Allow commits from other members")
mrCreateCmd.Flags().BoolP("remove-source-branch", "", false, "Remove Source Branch on merge")
mrCmd.AddCommand(mrCreateCmd)
}
}
8 changes: 4 additions & 4 deletions commands/mr_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
)

var mrDeleteCmd = &cobra.Command{
Use: "delete <id>",
Short: `Delete merge requests`,
Long: ``,
Use: "delete <id>",
Short: `Delete merge requests`,
Long: ``,
Aliases: []string{"del"},
Args: cobra.MaximumNArgs(1),
Example: "$ glab delete 123",
RunE: deleteMergeRequest,
RunE: deleteMergeRequest,
}

func deleteMergeRequest(cmd *cobra.Command, args []string) error {
Expand Down
10 changes: 5 additions & 5 deletions commands/mr_issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
)

var mrIssuesCmd = &cobra.Command{
Use: "issues <id>",
Short: `Get issues related to a particular merge request.`,
Long: ``,
Use: "issues <id>",
Short: `Get issues related to a particular merge request.`,
Long: ``,
Aliases: []string{"issue"},
Args: cobra.MaximumNArgs(1),
Example: "$ glab mr issues 46",
Run: issuesRelatedMergeRequest,
Run: issuesRelatedMergeRequest,
}

func issuesRelatedMergeRequest(cmd *cobra.Command, args []string) {
Expand All @@ -36,4 +36,4 @@ func issuesRelatedMergeRequest(cmd *cobra.Command, args []string) {

func init() {
mrCmd.AddCommand(mrIssuesCmd)
}
}
16 changes: 8 additions & 8 deletions commands/mr_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import (
)

var mrListCmd = &cobra.Command{
Use: "list [flags]",
Short: `List merge requests`,
Long: ``,
Use: "list [flags]",
Short: `List merge requests`,
Long: ``,
Aliases: []string{"ls"},
Args: cobra.MaximumNArgs(3),
RunE: listMergeRequest,
RunE: listMergeRequest,
}

func listMergeRequest(cmd *cobra.Command, args []string) error {
var state string
if lb, _ := cmd.Flags().GetBool("all"); lb {
if lb, _ := cmd.Flags().GetBool("all"); lb {
state = "all"
} else if lb, _ := cmd.Flags().GetBool("closed"); lb {
} else if lb, _ := cmd.Flags().GetBool("closed"); lb {
state = "closed"
} else if lb, _ := cmd.Flags().GetBool("merged"); lb {
} else if lb, _ := cmd.Flags().GetBool("merged"); lb {
state = "merged"
} else {
state = "opened"
Expand All @@ -36,7 +36,7 @@ func listMergeRequest(cmd *cobra.Command, args []string) error {
}
l.Labels = &label
}
if lb, _ := cmd.Flags().GetString("milestone"); lb != "" {
if lb, _ := cmd.Flags().GetString("milestone"); lb != "" {
l.Milestone = gitlab.String(lb)
}

Expand Down
10 changes: 5 additions & 5 deletions commands/mr_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
)

var mrMergeCmd = &cobra.Command{
Use: "merge <id> [flags]",
Short: `Merge/Accept merge requests`,
Long: ``,
Use: "merge <id> [flags]",
Short: `Merge/Accept merge requests`,
Long: ``,
Aliases: []string{"accept"},
Run: acceptMergeRequest,
Run: acceptMergeRequest,
}

func acceptMergeRequest(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -68,4 +68,4 @@ func init() {
mrMergeCmd.Flags().StringP("squash-message", "", "", "Squash commit message")
mrMergeCmd.Flags().BoolP("squash", "s", false, "Squash commits on merge")
mrCmd.AddCommand(mrMergeCmd)
}
}
Loading

0 comments on commit 557e209

Please sign in to comment.