diff --git a/internal/repository/github/github.go b/internal/repository/github/github.go index a176d60..2c62451 100644 --- a/internal/repository/github/github.go +++ b/internal/repository/github/github.go @@ -20,12 +20,12 @@ type githubService struct { } // newGithubRepo creates a new GitHub repository service -func New(token string) (*githubService, error) { +func New(token string) githubService { client := github.NewClient(nil) s := githubService{client: &githubClient{client: client}, token: token} - return &s, nil + return s } func (s githubService) GetProjectList(paths []string) (projects []repository.Project, warn error) { diff --git a/internal/repository/github/github_test.go b/internal/repository/github/github_test.go index 00bc0d0..20c84c2 100644 --- a/internal/repository/github/github_test.go +++ b/internal/repository/github/github_test.go @@ -9,13 +9,6 @@ import ( "github.com/stretchr/testify/mock" ) -func TestNewService(t *testing.T) { - s, err := New("token") - - assert.Nil(t, err) - assert.NotNil(t, s) -} - func TestGetProjectListOrganizationRepos(t *testing.T) { mockService := mockService{} mockService.On("GetOrganizationRepositories", "org", mock.Anything).Return([]*github.Repository{{Name: github.Ptr("Hello World")}}, &github.Response{}, nil) diff --git a/internal/repository/provider/provider.go b/internal/repository/provider/provider.go index 90d6336..f38b261 100644 --- a/internal/repository/provider/provider.go +++ b/internal/repository/provider/provider.go @@ -24,10 +24,7 @@ func NewProvider(gitlabToken string, githubToken string) (IProvider, error) { return nil, errors.Join(fmt.Errorf("failed to create gitlab provider"), err) } - githubService, err := github.New(githubToken) - if err != nil { - return nil, errors.Join(fmt.Errorf("failed to create github provider"), err) - } + githubService := github.New(githubToken) return provider{ gitlabService: gitlabService,