Chore: use any rather than interface{} (#74066)

This commit is contained in:
Ryan McKinley
2023-08-30 08:46:47 -07:00
committed by GitHub
parent 3e272d2bda
commit 025b2f3011
525 changed files with 2528 additions and 2528 deletions

View File

@ -52,14 +52,14 @@ func init() {
// Non-optimal global solution to replace plugin SDK default loggers for core plugins.
sdklog.DefaultLogger = &logWrapper{logger: log.New("plugin.coreplugin")}
backend.Logger = sdklog.DefaultLogger
backend.NewLoggerWith = func(args ...interface{}) sdklog.Logger {
backend.NewLoggerWith = func(args ...any) sdklog.Logger {
for i, arg := range args {
// Obtain logger name from args.
if s, ok := arg.(string); ok && s == "logger" {
l := &logWrapper{logger: log.New(args[i+1].(string))}
// new args slice without logger name and logger name value
if len(args) > 2 {
newArgs := make([]interface{}, 0, len(args)-2)
newArgs := make([]any, 0, len(args)-2)
newArgs = append(newArgs, args[:i]...)
newArgs = append(newArgs, args[i+2:]...)
return l.With(newArgs...)
@ -120,7 +120,7 @@ func (cr *Registry) BackendFactoryProvider() func(_ context.Context, p *plugins.
}
}
func asBackendPlugin(svc interface{}) backendplugin.PluginFactoryFunc {
func asBackendPlugin(svc any) backendplugin.PluginFactoryFunc {
opts := backend.ServeOpts{}
if queryHandler, ok := svc.(backend.QueryDataHandler); ok {
opts.QueryDataHandler = queryHandler
@ -147,19 +147,19 @@ type logWrapper struct {
logger log.Logger
}
func (l *logWrapper) Debug(msg string, args ...interface{}) {
func (l *logWrapper) Debug(msg string, args ...any) {
l.logger.Debug(msg, args...)
}
func (l *logWrapper) Info(msg string, args ...interface{}) {
func (l *logWrapper) Info(msg string, args ...any) {
l.logger.Info(msg, args...)
}
func (l *logWrapper) Warn(msg string, args ...interface{}) {
func (l *logWrapper) Warn(msg string, args ...any) {
l.logger.Warn(msg, args...)
}
func (l *logWrapper) Error(msg string, args ...interface{}) {
func (l *logWrapper) Error(msg string, args ...any) {
l.logger.Error(msg, args...)
}
@ -167,7 +167,7 @@ func (l *logWrapper) Level() sdklog.Level {
return sdklog.NoLevel
}
func (l *logWrapper) With(args ...interface{}) sdklog.Logger {
func (l *logWrapper) With(args ...any) sdklog.Logger {
l.logger = l.logger.New(args...)
return l
}