Upgrade the linter to golangci-lint@v1.55.1

The unused-parameter linter became stricter, so we adjust it to
allow unused params that start with underscore. It can be nice to keep
unused param names when implementing an interface sometimes, to help
readers understand why it is unused in that particular implementation.
This commit is contained in:
Ryan Richard
2023-11-02 09:54:16 -07:00
parent 3c2d921300
commit 29e939db7f
12 changed files with 86 additions and 78 deletions
@@ -212,7 +212,7 @@ func (u *TestUpstreamLDAPIdentityProvider) GetName() string {
return u.Name
}
func (u *TestUpstreamLDAPIdentityProvider) AuthenticateUser(ctx context.Context, username, password string, grantedScopes []string) (*authenticators.Response, bool, error) {
func (u *TestUpstreamLDAPIdentityProvider) AuthenticateUser(ctx context.Context, username, password string, _grantedScopes []string) (*authenticators.Response, bool, error) {
return u.AuthenticateFunc(ctx, username, password)
}
@@ -220,7 +220,7 @@ func (u *TestUpstreamLDAPIdentityProvider) GetURL() *url.URL {
return u.URL
}
func (u *TestUpstreamLDAPIdentityProvider) PerformRefresh(ctx context.Context, storedRefreshAttributes upstreamprovider.RefreshAttributes, idpDisplayName string) ([]string, error) {
func (u *TestUpstreamLDAPIdentityProvider) PerformRefresh(ctx context.Context, storedRefreshAttributes upstreamprovider.RefreshAttributes, _idpDisplayName string) ([]string, error) {
if u.performRefreshArgs == nil {
u.performRefreshArgs = make([]*PerformRefreshArgs, 0)
}
+11 -11
View File
@@ -105,7 +105,7 @@ func (l logger) Info(level int, msg string, kvList ...interface{}) {
}
}
func (l logger) Enabled(level int) bool {
func (l logger) Enabled(_level int) bool {
return true
}
@@ -134,7 +134,7 @@ func (l logger) output(calldepth int, s string) {
}
}
func (l logger) V(level int) logr.LogSink {
func (l logger) V(_level int) logr.LogSink {
return l.clone()
}
@@ -142,27 +142,27 @@ func (l logger) V(level int) logr.LogSink {
// uses '/' characters to separate name elements. Callers should not pass '/'
// in the provided name string, but this library does not actually enforce that.
func (l logger) WithName(name string) logr.LogSink {
new := l.clone()
lgr := l.clone()
if len(l.prefix) > 0 {
new.prefix = l.prefix + "/"
lgr.prefix = l.prefix + "/"
}
new.prefix += name
return new
lgr.prefix += name
return lgr
}
// WithValues returns a new logr.Logger with the specified key-and-values
// saved.
func (l logger) WithValues(kvList ...interface{}) logr.LogSink {
new := l.clone()
new.values = append(new.values, kvList...)
return new
lgr := l.clone()
lgr.values = append(lgr.values, kvList...)
return lgr
}
func (l logger) WithCallDepth(depth int) logr.LogSink {
func (l logger) WithCallDepth(_depth int) logr.LogSink {
return l.clone()
}
var _ logr.LogSink = logger{}
var _ logr.CallDepthLogSink = logger{}
func (l logger) Init(info logr.RuntimeInfo) {}
func (l logger) Init(_info logr.RuntimeInfo) {}
+4 -4
View File
@@ -1,4 +1,4 @@
// Copyright 2020-2022 the Pinniped contributors. All Rights Reserved.
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package testutil
@@ -37,7 +37,7 @@ func (log *TranscriptLogger) Transcript() []TranscriptLogMessage {
return result
}
func (log *TranscriptLogger) Info(level int, msg string, keysAndValues ...interface{}) {
func (log *TranscriptLogger) Info(_level int, msg string, keysAndValues ...interface{}) {
log.lock.Lock()
defer log.lock.Unlock()
log.transcript = append(log.transcript, TranscriptLogMessage{
@@ -55,7 +55,7 @@ func (log *TranscriptLogger) Error(_ error, msg string, _ ...interface{}) {
})
}
func (log *TranscriptLogger) Enabled(level int) bool {
func (log *TranscriptLogger) Enabled(_level int) bool {
return true
}
@@ -71,4 +71,4 @@ func (log *TranscriptLogger) WithValues(_ ...interface{}) logr.LogSink {
return log
}
func (log *TranscriptLogger) Init(info logr.RuntimeInfo) {}
func (log *TranscriptLogger) Init(_info logr.RuntimeInfo) {}