From 4646c7c52d453dcc817f8e14b991de0e4f67b492 Mon Sep 17 00:00:00 2001 From: delvh Date: Thu, 2 Dec 2021 20:36:50 +0100 Subject: [PATCH] Use fmt.Sprintf correctly (#17886) --- contrib/pr/checkout.go | 2 +- models/pull.go | 2 +- modules/convert/pull.go | 2 +- modules/migration/pullrequest.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/pr/checkout.go b/contrib/pr/checkout.go index 231ac6452e..e9dd675d4d 100644 --- a/contrib/pr/checkout.go +++ b/contrib/pr/checkout.go @@ -215,7 +215,7 @@ func main() { //Use git cli command for windows runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch)) } else { - ref := fmt.Sprintf(gitea_git.PullPrefix+"%s/head:%s", pr, branchRef) + ref := fmt.Sprintf("%s%s/head:%s", gitea_git.PullPrefix, pr, branchRef) err = repo.Fetch(&git.FetchOptions{ RemoteName: remoteUpstream, RefSpecs: []config.RefSpec{ diff --git a/models/pull.go b/models/pull.go index e112aea66a..aa58322bce 100644 --- a/models/pull.go +++ b/models/pull.go @@ -350,7 +350,7 @@ func (pr *PullRequest) GetDefaultSquashMessage() string { // GetGitRefName returns git ref for hidden pull request branch func (pr *PullRequest) GetGitRefName() string { - return fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index) + return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index) } // IsChecking returns true if this pull request is still checking conflict. diff --git a/modules/convert/pull.go b/modules/convert/pull.go index a5e7d9608a..2e2c1b85bc 100644 --- a/modules/convert/pull.go +++ b/modules/convert/pull.go @@ -79,7 +79,7 @@ func ToAPIPullRequest(pr *models.PullRequest, doer *user_model.User) *api.PullRe }, Head: &api.PRBranchInfo{ Name: pr.HeadBranch, - Ref: fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index), + Ref: fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index), RepoID: -1, }, } diff --git a/modules/migration/pullrequest.go b/modules/migration/pullrequest.go index 498768ea48..bbf1fe7653 100644 --- a/modules/migration/pullrequest.go +++ b/modules/migration/pullrequest.go @@ -45,7 +45,7 @@ func (p *PullRequest) IsForkPullRequest() bool { // GetGitRefName returns pull request relative path to head func (p PullRequest) GetGitRefName() string { - return fmt.Sprintf(git.PullPrefix+"%d/head", p.Number) + return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number) } // PullRequestBranch represents a pull request branch