summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-07-04 20:36:08 +0200
committerGitHub <noreply@github.com>2023-07-04 20:36:08 +0200
commit88f835192d1a554d233b0ec4daa33276b7eb2910 (patch)
tree438140c295791e64a3b78dcfeae57701bcf296c3 /cmd
parentSeveral fixes for mobile UI (#25634) (diff)
downloadforgejo-88f835192d1a554d233b0ec4daa33276b7eb2910.tar.xz
forgejo-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 '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)"
}