Plugins: Optimize creation of Golang errors and slices (#69448)

* tidy up

* fix tests
This commit is contained in:
Will Browne
2023-06-07 17:22:43 +02:00
committed by GitHub
parent 8a8b5da1ee
commit 1fd4953833
13 changed files with 72 additions and 66 deletions

View File

@@ -2,7 +2,7 @@ package loader
import (
"context"
"fmt"
"errors"
"path/filepath"
"sort"
"testing"
@@ -1048,7 +1048,7 @@ func TestLoader_Load_SkipUninitializedPlugins(t *testing.T) {
procPrvdr.BackendFactoryFunc = func(ctx context.Context, p *plugins.Plugin) backendplugin.PluginFactoryFunc {
return func(pluginID string, _ log.Logger, _ []string) (backendplugin.Plugin, error) {
if pluginID == "test-datasource" {
return nil, fmt.Errorf("failed to initialize")
return nil, errors.New("failed to initialize")
}
return &fakes.FakePluginClient{}, nil
}