Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367)

Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
This commit is contained in:
Renovate Bot 2025-03-28 22:22:21 +00:00 committed by forgejo-renovate-action
parent 51ff4970ec
commit fed2d81c44
427 changed files with 2043 additions and 2046 deletions

View file

@ -216,11 +216,11 @@ func TestAddLdapBindDn(t *testing.T) {
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "case %d: should not call updateAuthSource", n)
assert.FailNow(t, "should not call updateAuthSource", "case: %d", n)
return nil
},
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
assert.FailNow(t, "case %d: should not call getAuthSourceByID", n)
assert.FailNow(t, "should not call getAuthSourceByID", "case: %d", n)
return nil, nil
},
}
@ -447,11 +447,11 @@ func TestAddLdapSimpleAuth(t *testing.T) {
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "case %d: should not call updateAuthSource", n)
assert.FailNow(t, "should not call updateAuthSource", "case: %d", n)
return nil
},
getAuthSourceByID: func(ctx context.Context, id int64) (*auth.Source, error) {
assert.FailNow(t, "case %d: should not call getAuthSourceByID", n)
assert.FailNow(t, "should not call getAuthSourceByID", "case: %d", n)
return nil, nil
},
}
@ -898,7 +898,7 @@ func TestUpdateLdapBindDn(t *testing.T) {
return nil
},
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "case %d: should not call createAuthSource", n)
assert.FailNow(t, "should not call createAuthSource", "case: %d", n)
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {
@ -1288,7 +1288,7 @@ func TestUpdateLdapSimpleAuth(t *testing.T) {
return nil
},
createAuthSource: func(ctx context.Context, authSource *auth.Source) error {
assert.FailNow(t, "case %d: should not call createAuthSource", n)
assert.FailNow(t, "should not call createAuthSource", "case: %d", n)
return nil
},
updateAuthSource: func(ctx context.Context, authSource *auth.Source) error {

View file

@ -143,11 +143,12 @@ func setupDoctorDefaultLogger(ctx *cli.Context, colorize bool) {
setupConsoleLogger(log.FATAL, log.CanColorStderr, os.Stderr)
logFile := ctx.String("log-file")
if logFile == "" {
switch logFile {
case "":
return // if no doctor log-file is set, do not show any log from default logger
} else if logFile == "-" {
case "-":
setupConsoleLogger(log.TRACE, colorize, os.Stdout)
} else {
default:
logFile, _ = filepath.Abs(logFile)
writeMode := log.WriterMode{Level: log.TRACE, WriterOption: log.WriterFileOption{FileName: logFile}}
writer, err := log.NewEventWriter("console-to-file", "file", writeMode)

View file

@ -220,10 +220,7 @@ Forgejo or set your environment appropriately.`, "")
}
}
supportProcReceive := false
if git.CheckGitVersionAtLeast("2.29") == nil {
supportProcReceive = true
}
supportProcReceive := git.CheckGitVersionAtLeast("2.29") == nil
for scanner.Scan() {
// TODO: support news feeds for wiki

View file

@ -122,9 +122,9 @@ func NewMainApp(version, versionExtra string) *cli.App {
}
executable := filepath.Base(path)
var subCmdsStandalone []*cli.Command = make([]*cli.Command, 0, 10)
var subCmdWithConfig []*cli.Command = make([]*cli.Command, 0, 10)
var globalFlags []cli.Flag = make([]cli.Flag, 0, 10)
subCmdsStandalone := make([]*cli.Command, 0, 10)
subCmdWithConfig := make([]*cli.Command, 0, 10)
globalFlags := make([]cli.Flag, 0, 10)
//
// If the executable is forgejo-cli, provide a Forgejo specific CLI

View file

@ -132,14 +132,14 @@ func TestCliCmdError(t *testing.T) {
r, err := runTestApp(app, "./gitea", "test-cmd")
require.Error(t, err)
assert.Equal(t, 1, r.ExitCode)
assert.Equal(t, "", r.Stdout)
assert.Empty(t, r.Stdout)
assert.Equal(t, "Command error: normal error\n", r.Stderr)
app = newTestApp(func(ctx *cli.Context) error { return cli.Exit("exit error", 2) })
r, err = runTestApp(app, "./gitea", "test-cmd")
require.Error(t, err)
assert.Equal(t, 2, r.ExitCode)
assert.Equal(t, "", r.Stdout)
assert.Empty(t, r.Stdout)
assert.Equal(t, "exit error\n", r.Stderr)
app = newTestApp(func(ctx *cli.Context) error { return nil })
@ -147,12 +147,12 @@ func TestCliCmdError(t *testing.T) {
require.Error(t, err)
assert.Equal(t, 1, r.ExitCode)
assert.Equal(t, "Incorrect Usage: flag provided but not defined: -no-such\n\n", r.Stdout)
assert.Equal(t, "", r.Stderr) // the cli package's strange behavior, the error message is not in stderr ....
assert.Empty(t, r.Stderr) // the cli package's strange behavior, the error message is not in stderr ....
app = newTestApp(func(ctx *cli.Context) error { return nil })
r, err = runTestApp(app, "./gitea", "test-cmd")
require.NoError(t, err)
assert.Equal(t, -1, r.ExitCode) // the cli.OsExiter is not called
assert.Equal(t, "", r.Stdout)
assert.Equal(t, "", r.Stderr)
assert.Empty(t, r.Stdout)
assert.Empty(t, r.Stderr)
}

View file

@ -81,8 +81,8 @@ func TestMigratePackages(t *testing.T) {
entries, err := os.ReadDir(p)
require.NoError(t, err)
assert.Len(t, entries, 2)
assert.EqualValues(t, "01", entries[0].Name())
assert.EqualValues(t, "tmp", entries[1].Name())
assert.Equal(t, "01", entries[0].Name())
assert.Equal(t, "tmp", entries[1].Name())
}
func TestMigrateActionsArtifacts(t *testing.T) {

View file

@ -253,11 +253,12 @@ func runServ(c *cli.Context) error {
}
if verb == lfsAuthenticateVerb {
if lfsVerb == "upload" {
switch lfsVerb {
case "upload":
requestedMode = perm.AccessModeWrite
} else if lfsVerb == "download" {
case "download":
requestedMode = perm.AccessModeRead
} else {
default:
return fail(ctx, "Unknown LFS verb", "Unknown lfs verb %s", lfsVerb)
}
}