aboutsummaryrefslogtreecommitdiffstats
path: root/models/repo.go
diff options
context:
space:
mode:
authorBo-Yi Wu <appleboy.tw@gmail.com>2021-03-15 02:52:12 +0800
committerGitHub <noreply@github.com>2021-03-14 19:52:12 +0100
commit167b0f46ef946fad3ca13976c3b87598f505e2ea (patch)
tree8b6a4a47a2a0149899b3eb49b296677c2dba4d36 /models/repo.go
parent164e35ead3c1b9b82d4a23644f6fe96652a747eb (diff)
downloadgitea-167b0f46ef946fad3ca13976c3b87598f505e2ea.tar.gz
gitea-167b0f46ef946fad3ca13976c3b87598f505e2ea.zip
chore(models): rewrite code format. (#14754)
* chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
Diffstat (limited to 'models/repo.go')
-rw-r--r--models/repo.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/models/repo.go b/models/repo.go
index 2c71fc3e1e..15d6351251 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -1070,7 +1070,7 @@ func CreateRepository(ctx DBContext, doer, u *User, repo *Repository, overwriteO
}
// insert units for repo
- var units = make([]RepoUnit, 0, len(DefaultRepoUnits))
+ units := make([]RepoUnit, 0, len(DefaultRepoUnits))
for _, tp := range DefaultRepoUnits {
if tp == UnitTypeIssues {
units = append(units, RepoUnit{
@@ -1636,7 +1636,7 @@ func GetRepositoryByIDCtx(ctx DBContext, id int64) (*Repository, error) {
// GetRepositoriesMapByIDs returns the repositories by given id slice.
func GetRepositoriesMapByIDs(ids []int64) (map[int64]*Repository, error) {
- var repos = make(map[int64]*Repository, len(ids))
+ repos := make(map[int64]*Repository, len(ids))
return repos, x.In("id", ids).Find(&repos)
}
@@ -1646,7 +1646,7 @@ func GetUserRepositories(opts *SearchRepoOptions) ([]*Repository, int64, error)
opts.OrderBy = "updated_unix DESC"
}
- var cond = builder.NewCond()
+ cond := builder.NewCond()
cond = cond.And(builder.Eq{"owner_id": opts.Actor.ID})
if !opts.Private {
cond = cond.And(builder.Eq{"is_private": false})
@@ -2096,9 +2096,9 @@ func DoctorUserStarNum() (err error) {
// IterateRepository iterate repositories
func IterateRepository(f func(repo *Repository) error) error {
var start int
- var batchSize = setting.Database.IterateBufferSize
+ batchSize := setting.Database.IterateBufferSize
for {
- var repos = make([]*Repository, 0, batchSize)
+ repos := make([]*Repository, 0, batchSize)
if err := x.Limit(batchSize, start).Find(&repos); err != nil {
return err
}