Skip to content

Commit

Permalink
Remvoe aws go sdk package dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Dec 29, 2024
1 parent ff96873 commit d25f056
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions modules/util/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,7 @@ func SplitTrimSpace(input, sep string) []string {
}
return stringList
}

func StringPointer(s string) *string {
return &s
}
10 changes: 5 additions & 5 deletions services/migrations/codecommit.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
"code.gitea.io/gitea/modules/log"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"

"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/codecommit"
"github.com/aws/aws-sdk-go-v2/service/codecommit/types"
"github.com/aws/aws-sdk-go/aws"
)

var (
Expand Down Expand Up @@ -94,7 +94,7 @@ func (c *CodeCommitDownloader) SetContext(ctx context.Context) {
// GetRepoInfo returns a repository information
func (c *CodeCommitDownloader) GetRepoInfo() (*base.Repository, error) {
output, err := c.codeCommitClient.GetRepository(c.ctx, &codecommit.GetRepositoryInput{
RepositoryName: aws.String(c.repoName),
RepositoryName: util.StringPointer(c.repoName),
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -126,7 +126,7 @@ func (c *CodeCommitDownloader) GetComments(commentable base.Commentable) ([]*bas
for {
resp, err := c.codeCommitClient.GetCommentsForPullRequest(c.ctx, &codecommit.GetCommentsForPullRequestInput{
NextToken: nextToken,
PullRequestId: aws.String(strconv.FormatInt(commentable.GetForeignIndex(), 10)),
PullRequestId: util.StringPointer(strconv.FormatInt(commentable.GetForeignIndex(), 10)),
})
if err != nil {
return nil, false, err
Expand Down Expand Up @@ -171,7 +171,7 @@ func (c *CodeCommitDownloader) GetPullRequests(page, perPage int) ([]*base.PullR
prs := make([]*base.PullRequest, 0, len(batch))
for _, id := range batch {
output, err := c.codeCommitClient.GetPullRequest(c.ctx, &codecommit.GetPullRequestInput{
PullRequestId: aws.String(id),
PullRequestId: util.StringPointer(id),
})
if err != nil {
return nil, false, err
Expand Down Expand Up @@ -243,7 +243,7 @@ func (c *CodeCommitDownloader) getAllPullRequestIDs() ([]string, error) {

for {
output, err := c.codeCommitClient.ListPullRequests(c.ctx, &codecommit.ListPullRequestsInput{
RepositoryName: aws.String(c.repoName),
RepositoryName: util.StringPointer(c.repoName),
NextToken: nextToken,
})
if err != nil {
Expand Down

0 comments on commit d25f056

Please sign in to comment.