Skip to content

Commit 5e42e6f

Browse files
committed
lint
1 parent 9d758d7 commit 5e42e6f

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

cmd/commentprcasdiff/comment_poster.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ type commentKey struct {
3939

4040
// postReviewComments posts review comments to specific lines in the PR diff. If a bot comment
4141
// already exists at the same file/line, it is updated instead of creating a duplicate.
42-
func postReviewComments(ctx context.Context, prNumber uint, gitCommitID string, comments ...prReviewComment) error {
42+
func postReviewComments(ctx context.Context, prNumber int, gitCommitID string, comments ...prReviewComment) error {
4343
client := githubutil.NewClient(ctx)
4444

45-
existingPRComments, err := listExistingBotComments(ctx, client, int(prNumber))
45+
existingPRComments, err := listExistingBotComments(ctx, client, prNumber)
4646
if err != nil {
4747
return fmt.Errorf("list existing bot comments: %w", err)
4848
}
@@ -55,7 +55,7 @@ func postReviewComments(ctx context.Context, prNumber uint, gitCommitID string,
5555
errsPosting = append(errsPosting, fmt.Errorf("updating existing comment in %v: %w", key, err))
5656
}
5757
} else {
58-
if err := postSingleReviewComment(ctx, client, int(prNumber), gitCommitID, comment); err != nil {
58+
if err := postSingleReviewComment(ctx, client, prNumber, gitCommitID, comment); err != nil {
5959
errsPosting = append(errsPosting, fmt.Errorf("posting new comment in %v: %w", key, err))
6060
}
6161
}
@@ -107,10 +107,10 @@ func postSingleReviewComment(ctx context.Context, client *githubutil.Client, prN
107107
string(githubutil.GithubRepoModules),
108108
prNumber,
109109
&github.PullRequestComment{
110-
CommitID: github.String(gitCommitID),
111-
Path: github.String(comment.filePath),
112-
Line: github.Int(comment.lineNumber),
113-
Body: github.String(body),
110+
CommitID: &gitCommitID,
111+
Path: &comment.filePath,
112+
Line: &comment.lineNumber,
113+
Body: &body,
114114
},
115115
)
116116
if err != nil {
@@ -127,7 +127,7 @@ func updateReviewComment(ctx context.Context, client *githubutil.Client, prComme
127127
string(githubutil.GithubRepoModules),
128128
prCommentID,
129129
&github.PullRequestComment{
130-
Body: github.String(body),
130+
Body: &body,
131131
},
132132
)
133133
if err != nil {

cmd/commentprcasdiff/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func run(ctx context.Context, flags *flags) error {
7171
baseRef := os.Getenv("BASE_REF")
7272
headRef := os.Getenv("HEAD_REF")
7373
prNumberString := os.Getenv("PR_NUMBER")
74-
var prNumber uint64
74+
var prNumber int
7575

7676
if baseRef == "" {
7777
return errors.New("BASE_REF environment variable is required")
@@ -87,7 +87,7 @@ func run(ctx context.Context, flags *flags) error {
8787
return errors.New("PR_NUMBER environment variable is required when not a dry-run")
8888
}
8989
var err error
90-
prNumber, err = strconv.ParseUint(prNumberString, 10, 64)
90+
prNumber, err = strconv.Atoi(prNumberString)
9191
if err != nil {
9292
return fmt.Errorf("parse PR_NUMBER: %w", err)
9393
}
@@ -199,7 +199,7 @@ func run(ctx context.Context, flags *flags) error {
199199
body: result.output,
200200
}
201201
}
202-
if err := postReviewComments(ctx, uint(prNumber), headRef, comments...); err != nil {
202+
if err := postReviewComments(ctx, prNumber, headRef, comments...); err != nil {
203203
errsToReturn = append(errsToReturn, fmt.Errorf("post review comments: %w", err))
204204
}
205205
}

0 commit comments

Comments
 (0)