aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-07-04 20:36:08 +0200
committerGitHub <noreply@github.com>2023-07-04 18:36:08 +0000
commit88f835192d1a554d233b0ec4daa33276b7eb2910 (patch)
tree438140c295791e64a3b78dcfeae57701bcf296c3 /services/migrations
parent00dbba7f4266032a2b91b760e7c611950ffad096 (diff)
downloadgitea-88f835192d1a554d233b0ec4daa33276b7eb2910.tar.gz
gitea-88f835192d1a554d233b0ec4daa33276b7eb2910.zip
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](https://github.com/golang/go/commit/2580d0e08d5e9f979b943758d3c49877fb2324cb).
Diffstat (limited to 'services/migrations')
-rw-r--r--services/migrations/codebase.go2
-rw-r--r--services/migrations/common.go2
-rw-r--r--services/migrations/dump.go12
-rw-r--r--services/migrations/onedev.go8
4 files changed, 12 insertions, 12 deletions
diff --git a/services/migrations/codebase.go b/services/migrations/codebase.go
index 22bf0f73de..492fc908e9 100644
--- a/services/migrations/codebase.go
+++ b/services/migrations/codebase.go
@@ -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
diff --git a/services/migrations/common.go b/services/migrations/common.go
index 34d7c93ddf..4f9837472d 100644
--- a/services/migrations/common.go
+++ b/services/migrations/common.go
@@ -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)
diff --git a/services/migrations/dump.go b/services/migrations/dump.go
index 729112bcd2..603954810c 100644
--- a/services/migrations/dump.go
+++ b/services/migrations/dump.go
@@ -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)
}
diff --git a/services/migrations/onedev.go b/services/migrations/onedev.go
index 33fc43c349..e2f7b771f3 100644
--- a/services/migrations/onedev.go
+++ b/services/migrations/onedev.go
@@ -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 {