Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Dec 20, 2023
1 parent 98224cf commit 984add0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
9 changes: 4 additions & 5 deletions cmd/upmerge_create.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"errors"
"fmt"
"github.com/SyliusLabs/gh-kit/internal/github"
"github.com/spf13/cobra"
Expand All @@ -23,7 +22,7 @@ func (c *UpmergeCreateCmd) RunE(cmd *cobra.Command, args []string) error {

compare, err := c.ghClient.Compare(base, target)
if nil != err {
return errors.New(fmt.Sprintf("🛑 An error occurred while comparing %s and %s: %s", base, target, err.Error()))
return fmt.Errorf("🛑 An error occurred while comparing %s and %s: %s", base, target, err.Error())
}

if 0 == compare.GetAheadBy() {
Expand All @@ -33,19 +32,19 @@ func (c *UpmergeCreateCmd) RunE(cmd *cobra.Command, args []string) error {

baseReference, err := c.ghClient.GetReference(fmt.Sprintf("heads/%s", base))
if nil != err {
return errors.New(fmt.Sprintf("🛑 The base reference %s does not exist", base))
return fmt.Errorf("🛑 The base reference %s does not exist", base)
}

branchName := fmt.Sprintf("upmerge/%s|%s/%s", base, target, baseReference.GetObject().GetSHA()[0:7])
err = c.ghClient.CreateReference(fmt.Sprintf("heads/%s", branchName), baseReference.GetObject().GetSHA())
if nil != err {
return errors.New(fmt.Sprintf("🛑 The upmerge branch could not be created: %s", err.Error()))
return fmt.Errorf("🛑 The upmerge branch could not be created: %s", err.Error())
}

prTitle := fmt.Sprintf("Upmerge %s into %s", base, target)
err = c.ghCli.CreatePullRequest(prTitle, prTitle, branchName, target)
if nil != err {
return errors.New(fmt.Sprintf("🛑 The upmerge pull request could not be created: %s", err.Error()))
return fmt.Errorf("🛑 The upmerge pull request could not be created: %s", err.Error())
}

fmt.Println("✅ The upmerge pull request has been created")
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/google/go-github/v57 v57.0.0
github.com/manifoldco/promptui v0.9.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.8.1
go.uber.org/fx v1.20.1
gopkg.in/h2non/gock.v1 v1.1.2
)
Expand All @@ -34,7 +34,6 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/dig v1.17.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions internal/github/client_pull_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package github

import (
"github.com/SyliusLabs/gh-kit/internal/test"
"github.com/cli/go-gh"
"github.com/google/go-github/v57/github"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
"testing"
)

Expand Down
2 changes: 2 additions & 0 deletions internal/github/client_workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package github

import (
"github.com/SyliusLabs/gh-kit/internal/test"
"github.com/cli/go-gh"
"github.com/google/go-github/v57/github"
"github.com/stretchr/testify/assert"
"gopkg.in/h2non/gock.v1"
"testing"
)

Expand Down

0 comments on commit 984add0

Please sign in to comment.