Skip to content

Commit 2547e1a

Browse files
committed
chore: change github client creation to value
1 parent 78f8edf commit 2547e1a

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

internal/repository/github/github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ type githubService struct {
2020
}
2121

2222
// newGithubRepo creates a new GitHub repository service
23-
func New(token string) (*githubService, error) {
23+
func New(token string) githubService {
2424
client := github.NewClient(nil)
2525

2626
s := githubService{client: &githubClient{client: client}, token: token}
2727

28-
return &s, nil
28+
return s
2929
}
3030

3131
func (s githubService) GetProjectList(paths []string) (projects []repository.Project, warn error) {

internal/repository/github/github_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ import (
99
"github.com/stretchr/testify/mock"
1010
)
1111

12-
func TestNewService(t *testing.T) {
13-
s, err := New("token")
14-
15-
assert.Nil(t, err)
16-
assert.NotNil(t, s)
17-
}
18-
1912
func TestGetProjectListOrganizationRepos(t *testing.T) {
2013
mockService := mockService{}
2114
mockService.On("GetOrganizationRepositories", "org", mock.Anything).Return([]*github.Repository{{Name: github.Ptr("Hello World")}}, &github.Response{}, nil)

internal/repository/provider/provider.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ func NewProvider(gitlabToken string, githubToken string) (IProvider, error) {
2424
return nil, errors.Join(fmt.Errorf("failed to create gitlab provider"), err)
2525
}
2626

27-
githubService, err := github.New(githubToken)
28-
if err != nil {
29-
return nil, errors.Join(fmt.Errorf("failed to create github provider"), err)
30-
}
27+
githubService := github.New(githubToken)
3128

3229
return provider{
3330
gitlabService: gitlabService,

0 commit comments

Comments
 (0)