Skip to content

Commit

Permalink
fix plugin lookup from path
Browse files Browse the repository at this point in the history
  • Loading branch information
d-rk committed Mar 14, 2024
1 parent 56e5bc1 commit 4f32f75
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions internal/util/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ func LoadPlugin[P plugin.Plugin, I any](pluginName string, pluginSpec plugins.Pl
return impl, err
}

output.Debugf("using plugin=%s location=%s", pluginName, pluginPath)

pluginLogger := output.CreateVerboseLogger(pluginName, global.GetFlags().Verbose)

logger := hclog.FromStandardLogger(pluginLogger, &hclog.LoggerOptions{
Expand Down Expand Up @@ -69,7 +71,7 @@ func resolvePluginPath(pluginName string) (string, error) {
pluginExecutable := fmt.Sprintf("kafkactl-%s-plugin%s", pluginName, extension)

// search in path
if _, err := os.Stat(pluginExecutable); err == nil {
if _, err := exec.LookPath(pluginExecutable); err == nil {
return pluginExecutable, nil
}

Expand All @@ -95,7 +97,7 @@ func resolvePluginPath(pluginName string) (string, error) {
pluginPath := filepath.Join(workingDir, "../kafkactl-plugins/"+pluginName)
pluginLocationWorkingDir := filepath.Join(pluginPath, pluginExecutable)

if _, err := os.Stat(pluginLocationWorkingDir); err == nil {
if _, err = os.Stat(pluginLocationWorkingDir); err == nil {
return pluginLocationWorkingDir, nil
}

Expand Down

0 comments on commit 4f32f75

Please sign in to comment.