pluginExt

package
v0.0.0-...-f277093 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package plg provides extensions and utilities for the standard plugin library. It aims to simplify plugin loading, symbol lookup, and error handling when working with Go plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAll

func LoadAll(paths []string) (map[string]*plugin.Plugin, error)

LoadAll loads multiple plugins from the given paths

func LoadAndLookup

func LoadAndLookup(path, symbolName string) (plugin.Symbol, error)

LoadAndLookup combines loading a plugin and looking up a symbol

func LoadOrError

func LoadOrError(path string) (*plugin.Plugin, error)

LoadOrError loads a plugin and returns an error if it cannot be loaded

func LookupFunc

func LookupFunc(p *plugin.Plugin, symbolName string, expectedType interface{}) (reflect.Value, error)

LookupFunc looks up a symbol and ensures it's a function matching the expected type

func LookupSymbol

func LookupSymbol(p *plugin.Plugin, symbolName string) (plugin.Symbol, error)

LookupSymbol looks up a symbol in a plugin with proper error handling

Types

type PluginCache

type PluginCache struct {
	// contains filtered or unexported fields
}

PluginCache provides a thread-safe cache for loaded plugins

func NewPluginCache

func NewPluginCache() *PluginCache

NewPluginCache creates a new plugin cache

func (*PluginCache) Load

func (pc *PluginCache) Load(path string) (*plugin.Plugin, error)

Load loads a plugin from the given path, caching the result

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL