Documentation
¶
Overview ¶
Package plugin provides gorisk's plugin loading infrastructure. Plugins are native Go plugins built with "go build -buildmode=plugin". Each plugin .so file must export one or both of:
- "CapabilityDetector" (gorisk.CapabilityDetector)
- "RiskScorer" (gorisk.RiskScorer)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CapabilityDetector ¶
type CapabilityDetector interface {
Language() string
DetectFile(path string) (map[string]float64, error)
}
CapabilityDetector mirrors gorisk.CapabilityDetector to avoid an import cycle. Plugins are loaded at runtime; we use the same method signatures.
type LoadedPlugin ¶
type LoadedPlugin struct {
Path string
Detector CapabilityDetector // nil if not exported
Scorer RiskScorer // nil if not exported
}
LoadedPlugin holds the symbols resolved from a single .so file.
func Load ¶
func Load(path string) (LoadedPlugin, error)
Load opens a single plugin .so file and resolves known symbols.
func LoadDir ¶
func LoadDir(dir string) ([]LoadedPlugin, []error)
LoadDir loads all .so plugin files from dir. Errors for individual files are collected and returned together; valid plugins are still returned.
Click to show internal directories.
Click to hide internal directories.