diff options
author | 6543 <6543@obermui.de> | 2020-12-25 09:59:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-25 11:59:32 +0200 |
commit | a19447aed128ecadfcd938d6a80cd4951af1f4ce (patch) | |
tree | 6312bf946d601aab29731645a4777feeaea66036 /models/repo.go | |
parent | 04ae0f2f3f4556c6d0b4adc5f2cffd0cc7d25151 (diff) | |
download | gitea-a19447aed128ecadfcd938d6a80cd4951af1f4ce.tar.gz gitea-a19447aed128ecadfcd938d6a80cd4951af1f4ce.zip |
migrate from com.* to alternatives (#14103)
* remove github.com/unknwon/com from models
* dont use "com.ToStr()"
* replace "com.ToStr" with "fmt.Sprint" where its easy to do
* more refactor
* fix test
* just "proxy" Copy func for now
* as per @lunny
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/models/repo.go b/models/repo.go index d791b6cbd2..7dfe14c85b 100644 --- a/models/repo.go +++ b/models/repo.go @@ -34,7 +34,6 @@ import ( "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/util" - "github.com/unknwon/com" "xorm.io/builder" ) @@ -85,7 +84,7 @@ func loadRepoConfig() { } for _, f := range customFiles { - if !com.IsSliceContainsStr(files, f) { + if !util.IsStringInSlice(f, files, true) { files = append(files, f) } } @@ -115,12 +114,12 @@ func loadRepoConfig() { // Filter out invalid names and promote preferred licenses. sortedLicenses := make([]string, 0, len(Licenses)) for _, name := range setting.Repository.PreferredLicenses { - if com.IsSliceContainsStr(Licenses, name) { + if util.IsStringInSlice(name, Licenses, true) { sortedLicenses = append(sortedLicenses, name) } } for _, name := range Licenses { - if !com.IsSliceContainsStr(setting.Repository.PreferredLicenses, name) { + if !util.IsStringInSlice(name, setting.Repository.PreferredLicenses, true) { sortedLicenses = append(sortedLicenses, name) } } @@ -1933,7 +1932,7 @@ func repoStatsCheck(ctx context.Context, checker *repoChecker) { return } for _, result := range results { - id := com.StrTo(result["id"]).MustInt64() + id, _ := strconv.ParseInt(string(result["id"]), 10, 64) select { case <-ctx.Done(): log.Warn("CheckRepoStats: Cancelled before checking %s for Repo[%d]", checker.desc, id) @@ -2001,7 +2000,7 @@ func CheckRepoStats(ctx context.Context) error { log.Error("Select %s: %v", desc, err) } else { for _, result := range results { - id := com.StrTo(result["id"]).MustInt64() + id, _ := strconv.ParseInt(string(result["id"]), 10, 64) select { case <-ctx.Done(): log.Warn("CheckRepoStats: Cancelled during %s for repo ID %d", desc, id) @@ -2024,7 +2023,7 @@ func CheckRepoStats(ctx context.Context) error { log.Error("Select %s: %v", desc, err) } else { for _, result := range results { - id := com.StrTo(result["id"]).MustInt64() + id, _ := strconv.ParseInt(string(result["id"]), 10, 64) select { case <-ctx.Done(): log.Warn("CheckRepoStats: Cancelled") @@ -2047,7 +2046,7 @@ func CheckRepoStats(ctx context.Context) error { log.Error("Select repository count 'num_forks': %v", err) } else { for _, result := range results { - id := com.StrTo(result["id"]).MustInt64() + id, _ := strconv.ParseInt(string(result["id"]), 10, 64) select { case <-ctx.Done(): log.Warn("CheckRepoStats: Cancelled") |