Skip to content

Commit 9441550

Browse files
committed
fix name, fix lint
1 parent c47d666 commit 9441550

File tree

7 files changed

+22
-25
lines changed

7 files changed

+22
-25
lines changed

cmd/admin.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ var (
5353
Commands: []*cli.Command{
5454
microcmdAuthAddOauth(),
5555
microcmdAuthUpdateOauth(),
56-
newMicrocmdAuthAddLdapBindDn(),
57-
newMicrocmdAuthUpdateLdapBindDn(),
58-
newMicrocmdAuthAddLdapSimpleAuth(),
59-
newMicrocmdAuthUpdateLdapSimpleAuth(),
56+
microcmdAuthAddLdapBindDn(),
57+
microcmdAuthUpdateLdapBindDn(),
58+
microcmdAuthAddLdapSimpleAuth(),
59+
microcmdAuthUpdateLdapSimpleAuth(),
6060
microcmdAuthAddSMTP(),
6161
microcmdAuthUpdateSMTP(),
6262
microcmdAuthList,

cmd/admin_auth_ldap.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type (
2424
}
2525
)
2626

27-
func newMicrocmdAuthAddLdapBindDn() *cli.Command {
27+
func microcmdAuthAddLdapBindDn() *cli.Command {
2828
return &cli.Command{
2929
Name: "add-ldap",
3030
Usage: "Add new LDAP (via Bind DN) authentication source",
@@ -68,7 +68,7 @@ func newMicrocmdAuthAddLdapBindDn() *cli.Command {
6868
}
6969
}
7070

71-
func newMicrocmdAuthUpdateLdapBindDn() *cli.Command {
71+
func microcmdAuthUpdateLdapBindDn() *cli.Command {
7272
return &cli.Command{
7373
Name: "update-ldap",
7474
Usage: "Update existing LDAP (via Bind DN) authentication source",
@@ -113,7 +113,7 @@ func newMicrocmdAuthUpdateLdapBindDn() *cli.Command {
113113
}
114114
}
115115

116-
func newMicrocmdAuthAddLdapSimpleAuth() *cli.Command {
116+
func microcmdAuthAddLdapSimpleAuth() *cli.Command {
117117
return &cli.Command{
118118
Name: "add-ldap-simple",
119119
Usage: "Add new LDAP (simple auth) authentication source",
@@ -145,7 +145,7 @@ func newMicrocmdAuthAddLdapSimpleAuth() *cli.Command {
145145
}
146146
}
147147

148-
func newMicrocmdAuthUpdateLdapSimpleAuth() *cli.Command {
148+
func microcmdAuthUpdateLdapSimpleAuth() *cli.Command {
149149
return &cli.Command{
150150
Name: "update-ldap-simple",
151151
Usage: "Update existing LDAP (simple auth) authentication source",

cmd/admin_auth_ldap_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func TestAddLdapBindDn(t *testing.T) {
239239

240240
// Create a copy of command to test
241241
app := cli.Command{
242-
Flags: newMicrocmdAuthAddLdapBindDn().Flags,
242+
Flags: microcmdAuthAddLdapBindDn().Flags,
243243
Action: service.addLdapBindDn,
244244
}
245245

@@ -469,7 +469,7 @@ func TestAddLdapSimpleAuth(t *testing.T) {
469469

470470
// Create a copy of command to test
471471
app := &cli.Command{
472-
Flags: newMicrocmdAuthAddLdapSimpleAuth().Flags,
472+
Flags: microcmdAuthAddLdapSimpleAuth().Flags,
473473
Action: service.addLdapSimpleAuth,
474474
}
475475

@@ -945,7 +945,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
945945

946946
// Create a copy of command to test
947947
app := cli.Command{
948-
Flags: newMicrocmdAuthUpdateLdapBindDn().Flags,
948+
Flags: microcmdAuthUpdateLdapBindDn().Flags,
949949
Action: service.updateLdapBindDn,
950950
}
951951
// Run it
@@ -1333,7 +1333,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
13331333

13341334
// Create a copy of command to test
13351335
app := cli.Command{
1336-
Flags: newMicrocmdAuthUpdateLdapSimpleAuth().Flags,
1336+
Flags: microcmdAuthUpdateLdapSimpleAuth().Flags,
13371337
Action: service.updateLdapSimpleAuth,
13381338
}
13391339
// Run it

cmd/admin_user_delete_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package cmd
55

66
import (
7-
"fmt"
7+
"strconv"
88
"strings"
99
"testing"
1010

@@ -34,7 +34,7 @@ func TestAdminUserDelete(t *testing.T) {
3434
setupTestUser(t)
3535

3636
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{LowerName: "testuser"})
37-
err := microcmdUserDelete().Run(ctx, []string{"delete-test", "--id", fmt.Sprintf("%d", u.ID)})
37+
err := microcmdUserDelete().Run(ctx, []string{"delete-test", "--id", strconv.FormatInt(u.ID, 10)})
3838
require.NoError(t, err)
3939
unittest.AssertNotExistsBean(t, &user_model.User{LowerName: "testuser"})
4040
})
@@ -56,7 +56,7 @@ func TestAdminUserDelete(t *testing.T) {
5656
setupTestUser(t)
5757

5858
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{LowerName: "testuser"})
59-
err := microcmdUserDelete().Run(ctx, []string{"delete", "--id", fmt.Sprintf("%d", u.ID), "--username", "testuser", "--email", "[email protected]"})
59+
err := microcmdUserDelete().Run(ctx, []string{"delete", "--id", strconv.FormatInt(u.ID, 10), "--username", "testuser", "--email", "[email protected]"})
6060
require.NoError(t, err)
6161
unittest.AssertNotExistsBean(t, &user_model.User{LowerName: "testuser"})
6262
})
@@ -91,7 +91,6 @@ func TestAdminUserDeleteFailure(t *testing.T) {
9191
}
9292

9393
for _, tc := range testCases {
94-
9594
t.Run(tc.name, func(t *testing.T) {
9695
ctx := t.Context()
9796
if strings.Contains(tc.name, "user exists") {

cmd/cert.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ import (
2525
"github.com/urfave/cli/v3"
2626
)
2727

28-
// CmdCert represents the available cert sub-command.
29-
func CmdCert() *cli.Command {
28+
// cmdCert represents the available cert sub-command.
29+
func cmdCert() *cli.Command {
3030
return &cli.Command{
3131
Name: "cert",
3232
Usage: "Generate self-signed certificate",

cmd/cert_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,13 @@ func TestCertCommand(t *testing.T) {
4949

5050
for _, c := range cases {
5151
t.Run(c.name, func(t *testing.T) {
52-
app := CmdCert()
52+
app := cmdCert()
5353
tempDir := t.TempDir()
5454

5555
certFile := filepath.Join(tempDir, "cert.pem")
5656
keyFile := filepath.Join(tempDir, "key.pem")
5757

58-
args := append(c.args, "--out", certFile, "--keyout", keyFile)
59-
err := app.Run(t.Context(), args)
58+
err := app.Run(t.Context(), append(c.args, "--out", certFile, "--keyout", keyFile))
6059
require.NoError(t, err)
6160

6261
assert.FileExists(t, certFile)
@@ -107,13 +106,12 @@ func TestCertCommandFailures(t *testing.T) {
107106
}
108107
for _, c := range cases {
109108
t.Run(c.name, func(t *testing.T) {
110-
app := CmdCert()
109+
app := cmdCert()
111110
tempDir := t.TempDir()
112111

113112
certFile := filepath.Join(tempDir, "cert.pem")
114113
keyFile := filepath.Join(tempDir, "key.pem")
115-
args := append(c.args, "--out", certFile, "--keyout", keyFile)
116-
err := app.Run(t.Context(), args)
114+
err := app.Run(t.Context(), append(c.args, "--out", certFile, "--keyout", keyFile))
117115
require.Error(t, err)
118116
if c.errMsg != "" {
119117
assert.ErrorContains(t, err, c.errMsg)

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func NewMainApp(appVer AppVersion) *cli.Command {
149149

150150
// these sub-commands do not need the config file, and they do not depend on any path or environment variable.
151151
subCmdStandalone := []*cli.Command{
152-
CmdCert(),
152+
cmdCert(),
153153
CmdGenerate,
154154
CmdDocs,
155155
}

0 commit comments

Comments
 (0)