forked from forgejo/forgejo
Replace interface{}
with any
(#25686)
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.
Basically the same [as golang did](2580d0e08d
).
This commit is contained in:
parent
00dbba7f42
commit
88f835192d
233 changed files with 727 additions and 727 deletions
|
@ -127,7 +127,7 @@ func (d *CodebaseDownloader) FormatCloneURL(opts base.MigrateOptions, remoteAddr
|
|||
return opts.CloneAddr, nil
|
||||
}
|
||||
|
||||
func (d *CodebaseDownloader) callAPI(endpoint string, parameter map[string]string, result interface{}) error {
|
||||
func (d *CodebaseDownloader) callAPI(endpoint string, parameter map[string]string, result any) error {
|
||||
u, err := d.baseURL.Parse(endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
// WarnAndNotice will log the provided message and send a repository notice
|
||||
func WarnAndNotice(fmtStr string, args ...interface{}) {
|
||||
func WarnAndNotice(fmtStr string, args ...any) {
|
||||
log.Warn(fmtStr, args...)
|
||||
if err := system_model.CreateRepositoryNotice(fmt.Sprintf(fmtStr, args...)); err != nil {
|
||||
log.Error("create repository notice failed: ", err)
|
||||
|
|
|
@ -112,7 +112,7 @@ func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOp
|
|||
}
|
||||
defer f.Close()
|
||||
|
||||
bs, err := yaml.Marshal(map[string]interface{}{
|
||||
bs, err := yaml.Marshal(map[string]any{
|
||||
"name": repo.Name,
|
||||
"owner": repo.Owner,
|
||||
"description": repo.Description,
|
||||
|
@ -227,7 +227,7 @@ func (g *RepositoryDumper) CreateTopics(topics ...string) error {
|
|||
}
|
||||
defer f.Close()
|
||||
|
||||
bs, err := yaml.Marshal(map[string]interface{}{
|
||||
bs, err := yaml.Marshal(map[string]any{
|
||||
"topics": topics,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -380,7 +380,7 @@ func (g *RepositoryDumper) CreateIssues(issues ...*base.Issue) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (g *RepositoryDumper) createItems(dir string, itemFiles map[int64]*os.File, itemsMap map[int64][]interface{}) error {
|
||||
func (g *RepositoryDumper) createItems(dir string, itemFiles map[int64]*os.File, itemsMap map[int64][]any) error {
|
||||
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ func (g *RepositoryDumper) createItems(dir string, itemFiles map[int64]*os.File,
|
|||
return nil
|
||||
}
|
||||
|
||||
func (g *RepositoryDumper) encodeItems(number int64, items []interface{}, dir string, itemFiles map[int64]*os.File) error {
|
||||
func (g *RepositoryDumper) encodeItems(number int64, items []any, dir string, itemFiles map[int64]*os.File) error {
|
||||
itemFile := itemFiles[number]
|
||||
if itemFile == nil {
|
||||
var err error
|
||||
|
@ -413,7 +413,7 @@ func (g *RepositoryDumper) encodeItems(number int64, items []interface{}, dir st
|
|||
|
||||
// CreateComments creates comments of issues
|
||||
func (g *RepositoryDumper) CreateComments(comments ...*base.Comment) error {
|
||||
commentsMap := make(map[int64][]interface{}, len(comments))
|
||||
commentsMap := make(map[int64][]any, len(comments))
|
||||
for _, comment := range comments {
|
||||
commentsMap[comment.IssueIndex] = append(commentsMap[comment.IssueIndex], comment)
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error {
|
|||
|
||||
// CreateReviews create pull request reviews
|
||||
func (g *RepositoryDumper) CreateReviews(reviews ...*base.Review) error {
|
||||
reviewsMap := make(map[int64][]interface{}, len(reviews))
|
||||
reviewsMap := make(map[int64][]any, len(reviews))
|
||||
for _, review := range reviews {
|
||||
reviewsMap[review.IssueIndex] = append(reviewsMap[review.IssueIndex], review)
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ func (d *OneDevDownloader) LogString() string {
|
|||
return fmt.Sprintf("<OneDevDownloader %s [%d]/%s>", d.baseURL, d.repoID, d.repoName)
|
||||
}
|
||||
|
||||
func (d *OneDevDownloader) callAPI(endpoint string, parameter map[string]string, result interface{}) error {
|
||||
func (d *OneDevDownloader) callAPI(endpoint string, parameter map[string]string, result any) error {
|
||||
u, err := d.baseURL.Parse(endpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -400,9 +400,9 @@ func (d *OneDevDownloader) GetComments(commentable base.Commentable) ([]*base.Co
|
|||
}
|
||||
|
||||
rawChanges := make([]struct {
|
||||
Date time.Time `json:"date"`
|
||||
UserID int64 `json:"userId"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
Date time.Time `json:"date"`
|
||||
UserID int64 `json:"userId"`
|
||||
Data map[string]any `json:"data"`
|
||||
}, 0, 100)
|
||||
|
||||
if context.IsPullRequest {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue