From 391242968cbb59f10745643154bd7fe256b9dd8b Mon Sep 17 00:00:00 2001 From: Mark Rushakoff Date: Thu, 23 Feb 2023 14:45:52 -0500 Subject: [PATCH] chore(core): fix staticcheck issues Remove one duplicated import, and prefer to append a slice rather than iterating over each element to be appended. --- core/appconfig/config_test.go | 1 - core/appmodule/option.go | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/core/appconfig/config_test.go b/core/appconfig/config_test.go index e67408f6908a..4466981f85bb 100644 --- a/core/appconfig/config_test.go +++ b/core/appconfig/config_test.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/core/appmodule" "cosmossdk.io/core/internal" "cosmossdk.io/core/internal/testpb" - _ "cosmossdk.io/core/internal/testpb" ) func expectContainerErrorContains(t *testing.T, option depinject.Config, contains string) { diff --git a/core/appmodule/option.go b/core/appmodule/option.go index 4c041c0cb707..951bfc6e2d7c 100644 --- a/core/appmodule/option.go +++ b/core/appmodule/option.go @@ -20,9 +20,7 @@ func (f funcOption) apply(initializer *internal.ModuleInitializer) error { // documentation on the dependency injection system. func Provide(providers ...interface{}) Option { return funcOption(func(initializer *internal.ModuleInitializer) error { - for _, provider := range providers { - initializer.Providers = append(initializer.Providers, provider) - } + initializer.Providers = append(initializer.Providers, providers...) return nil }) } @@ -33,9 +31,7 @@ func Provide(providers ...interface{}) Option { // invokers impose no additional constraints on the dependency graph. Invoker functions should nil-check all inputs. func Invoke(invokers ...interface{}) Option { return funcOption(func(initializer *internal.ModuleInitializer) error { - for _, invoker := range invokers { - initializer.Invokers = append(initializer.Invokers, invoker) - } + initializer.Invokers = append(initializer.Invokers, invokers...) return nil }) }