summaryrefslogtreecommitdiffstats
path: root/cmd/admin_user_generate_access_token.go
diff options
context:
space:
mode:
authorCheng <36215014+ChengenH@users.noreply.github.com>2024-04-21 21:44:03 +0200
committerEarl Warren <contact@earl-warren.org>2024-04-28 15:39:00 +0200
commit2ec0c5e28454413856a6de48d197fa29170dd79b (patch)
tree24dd6a1f72b9a250f25729ad7ed495ed02ea4af2 /cmd/admin_user_generate_access_token.go
parentMerge pull request 'Fix issue watch button' (#3509) from fnetx/fix-issue-watc... (diff)
downloadforgejo-2ec0c5e28454413856a6de48d197fa29170dd79b.tar.xz
forgejo-2ec0c5e28454413856a6de48d197fa29170dd79b.zip
chore: use errors.New to replace fmt.Errorf with no parameters will much better (#30621)
use errors.New to replace fmt.Errorf with no parameters will much better (cherry picked from commit 9de443ced2c328d9b58a5e144a765f402aab859d)
Diffstat (limited to 'cmd/admin_user_generate_access_token.go')
-rw-r--r--cmd/admin_user_generate_access_token.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd/admin_user_generate_access_token.go b/cmd/admin_user_generate_access_token.go
index 6e78939680..6c2c10494e 100644
--- a/cmd/admin_user_generate_access_token.go
+++ b/cmd/admin_user_generate_access_token.go
@@ -4,6 +4,7 @@
package cmd
import (
+ "errors"
"fmt"
auth_model "code.gitea.io/gitea/models/auth"
@@ -42,7 +43,7 @@ var microcmdUserGenerateAccessToken = &cli.Command{
func runGenerateAccessToken(c *cli.Context) error {
if !c.IsSet("username") {
- return fmt.Errorf("You must provide a username to generate a token for")
+ return errors.New("You must provide a username to generate a token for")
}
ctx, cancel := installSignals()
@@ -68,7 +69,7 @@ func runGenerateAccessToken(c *cli.Context) error {
return err
}
if exist {
- return fmt.Errorf("access token name has been used already")
+ return errors.New("access token name has been used already")
}
// make sure the scopes are valid