Skip to content

Commit 4646c7c

Browse files
authored
Use fmt.Sprintf correctly (#17886)
1 parent fbf3208 commit 4646c7c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

contrib/pr/checkout.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func main() {
215215
//Use git cli command for windows
216216
runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch))
217217
} else {
218-
ref := fmt.Sprintf(gitea_git.PullPrefix+"%s/head:%s", pr, branchRef)
218+
ref := fmt.Sprintf("%s%s/head:%s", gitea_git.PullPrefix, pr, branchRef)
219219
err = repo.Fetch(&git.FetchOptions{
220220
RemoteName: remoteUpstream,
221221
RefSpecs: []config.RefSpec{

models/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
350350

351351
// GetGitRefName returns git ref for hidden pull request branch
352352
func (pr *PullRequest) GetGitRefName() string {
353-
return fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index)
353+
return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index)
354354
}
355355

356356
// IsChecking returns true if this pull request is still checking conflict.

modules/convert/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func ToAPIPullRequest(pr *models.PullRequest, doer *user_model.User) *api.PullRe
7979
},
8080
Head: &api.PRBranchInfo{
8181
Name: pr.HeadBranch,
82-
Ref: fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index),
82+
Ref: fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index),
8383
RepoID: -1,
8484
},
8585
}

modules/migration/pullrequest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (p *PullRequest) IsForkPullRequest() bool {
4545

4646
// GetGitRefName returns pull request relative path to head
4747
func (p PullRequest) GetGitRefName() string {
48-
return fmt.Sprintf(git.PullPrefix+"%d/head", p.Number)
48+
return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number)
4949
}
5050

5151
// PullRequestBranch represents a pull request branch

0 commit comments

Comments
 (0)