summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-07-05 05:41:32 +0200
committerGitHub <noreply@github.com>2023-07-04 23:41:32 -0400
commit24e64fe37225a315c74c00d1f5e4d024168feea6 (patch)
treec89664dca5a884d5fc0a322815ce3bc20247cf84 /cmd
parent4e310133f95ba8581c121a32596807721bdd6af9 (diff)
downloadgitea-24e64fe37225a315c74c00d1f5e4d024168feea6.tar.gz
gitea-24e64fe37225a315c74c00d1f5e4d024168feea6.zip
Replace `interface{}` with `any` (#25686) (#25687)
Same perl replacement as https://github.com/go-gitea/gitea/pull/25686 but for 1.20 to ease future backporting.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cert.go6
-rw-r--r--cmd/dump.go4
-rw-r--r--cmd/manager_logging.go6
-rw-r--r--cmd/serv.go2
4 files changed, 9 insertions, 9 deletions
diff --git a/cmd/cert.go b/cmd/cert.go
index 816659023c..897c10c899 100644
--- a/cmd/cert.go
+++ b/cmd/cert.go
@@ -63,7 +63,7 @@ Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
},
}
-func publicKey(priv interface{}) interface{} {
+func publicKey(priv any) any {
switch k := priv.(type) {
case *rsa.PrivateKey:
return &k.PublicKey
@@ -74,7 +74,7 @@ func publicKey(priv interface{}) interface{} {
}
}
-func pemBlockForKey(priv interface{}) *pem.Block {
+func pemBlockForKey(priv any) *pem.Block {
switch k := priv.(type) {
case *rsa.PrivateKey:
return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)}
@@ -94,7 +94,7 @@ func runCert(c *cli.Context) error {
return err
}
- var priv interface{}
+ var priv any
var err error
switch c.String("ecdsa-curve") {
case "":
diff --git a/cmd/dump.go b/cmd/dump.go
index 0b7c1d32c5..b1aed8aef4 100644
--- a/cmd/dump.go
+++ b/cmd/dump.go
@@ -161,7 +161,7 @@ It can be used for backup and capture Gitea server image to send to maintainer`,
},
}
-func fatal(format string, args ...interface{}) {
+func fatal(format string, args ...any) {
fmt.Fprintf(os.Stderr, format+"\n", args...)
log.Fatal(format, args...)
}
@@ -236,7 +236,7 @@ func runDump(ctx *cli.Context) error {
return err
}
- var iface interface{}
+ var iface any
if fileName == "-" {
iface, err = archiver.ByExtension(fmt.Sprintf(".%s", outType))
} else {
diff --git a/cmd/manager_logging.go b/cmd/manager_logging.go
index dd85cc26d8..70d1beb26d 100644
--- a/cmd/manager_logging.go
+++ b/cmd/manager_logging.go
@@ -178,7 +178,7 @@ func runAddConnLogger(c *cli.Context) error {
defer cancel()
setup(ctx, c.Bool("debug"))
- vals := map[string]interface{}{}
+ vals := map[string]any{}
mode := "conn"
vals["net"] = "tcp"
if c.IsSet("protocol") {
@@ -208,7 +208,7 @@ func runAddFileLogger(c *cli.Context) error {
defer cancel()
setup(ctx, c.Bool("debug"))
- vals := map[string]interface{}{}
+ vals := map[string]any{}
mode := "file"
if c.IsSet("filename") {
vals["filename"] = c.String("filename")
@@ -236,7 +236,7 @@ func runAddFileLogger(c *cli.Context) error {
return commonAddLogger(c, mode, vals)
}
-func commonAddLogger(c *cli.Context, mode string, vals map[string]interface{}) error {
+func commonAddLogger(c *cli.Context, mode string, vals map[string]any) error {
if len(c.String("level")) > 0 {
vals["level"] = log.LevelFromString(c.String("level")).String()
}
diff --git a/cmd/serv.go b/cmd/serv.go
index 79052e58a8..484e3bf404 100644
--- a/cmd/serv.go
+++ b/cmd/serv.go
@@ -95,7 +95,7 @@ var (
// fail prints message to stdout, it's mainly used for git serv and git hook commands.
// The output will be passed to git client and shown to user.
-func fail(ctx context.Context, userMessage, logMsgFmt string, args ...interface{}) error {
+func fail(ctx context.Context, userMessage, logMsgFmt string, args ...any) error {
if userMessage == "" {
userMessage = "Internal Server Error (no specific error)"
}