From 75f034a687fd2d79e7e29e1431fab2e597073e87 Mon Sep 17 00:00:00 2001 From: bizk Date: Wed, 20 Sep 2023 11:36:30 -0300 Subject: [PATCH] changed error message generation according to linter suggestions --- plugins.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins.go b/plugins.go index c5564a8..50f83ed 100644 --- a/plugins.go +++ b/plugins.go @@ -1,7 +1,6 @@ package rosetta import ( - "errors" "fmt" "os" "plugin" @@ -13,24 +12,24 @@ func LoadPlugin(ir codectypes.InterfaceRegistry, pluginLocation string) (err err pluginPathMain := fmt.Sprintf("./plugins/%s/main.so", pluginLocation) if _, err := os.Stat(pluginPathMain); os.IsExist(err) { - return errors.New(fmt.Sprintf("Plugin file '%s' does not exist %s", pluginPathMain, err.Error())) + return fmt.Errorf(fmt.Sprintf("Plugin file '%s' does not exist %s", pluginPathMain, err.Error())) } // load module plug, err := plugin.Open(pluginPathMain) if err != nil { - return errors.New(fmt.Sprintf("There was an error while opening plugin on %s - %s", pluginPathMain, err.Error())) + return fmt.Errorf(fmt.Sprintf("There was an error while opening plugin on %s - %s", pluginPathMain, err.Error())) } initZone, err := plug.Lookup("InitZone") if err != nil { - return errors.New(fmt.Sprintf("There was an error while initializing the zone %s", err.Error())) + return fmt.Errorf(fmt.Sprintf("There was an error while initializing the zone %s", err.Error())) } initZone.(func())() registerInterfaces, err := plug.Lookup("RegisterInterfaces") if err != nil { - return errors.New(fmt.Sprintf("There was an error while registering interfaces %s", err.Error())) + return fmt.Errorf(fmt.Sprintf("There was an error while registering interfaces %s", err.Error())) } registerInterfaces.(func(codectypes.InterfaceRegistry))(ir)