Replace util.SliceXxx with slices.Xxx (#26958)

This commit is contained in:
CaiCandong 2023-09-07 17:37:47 +08:00 committed by GitHub
parent e97e883ad5
commit a78c2eae24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 46 additions and 110 deletions

View file

@ -7,6 +7,7 @@ package repo
import (
"fmt"
"net/http"
"slices"
"strings"
"time"
@ -235,7 +236,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *user_model.User, opt api.Cre
}
// If the readme template does not exist, a 400 will be returned.
if opt.AutoInit && len(opt.Readme) > 0 && !util.SliceContains(repo_module.Readmes, opt.Readme) {
if opt.AutoInit && len(opt.Readme) > 0 && !slices.Contains(repo_module.Readmes, opt.Readme) {
ctx.Error(http.StatusBadRequest, "", fmt.Errorf("readme template does not exist, available templates: %v", repo_module.Readmes))
return
}