github.com/projecteru2/core@v0.0.0-20240321043226-06bcc1c23f58/resource/plugins/binary/binary.go (about) 1 package binary 2 3 import ( 4 "context" 5 "path/filepath" 6 7 ppath "path" 8 9 coretypes "github.com/projecteru2/core/types" 10 ) 11 12 // Plugin 13 type Plugin struct { 14 name string 15 path string 16 config coretypes.Config 17 } 18 19 // NewPlugin . 20 func NewPlugin(_ context.Context, path string, config coretypes.Config) (*Plugin, error) { 21 p, err := filepath.Abs(path) 22 if err != nil { 23 return nil, err 24 } 25 plugin := &Plugin{name: ppath.Base(path), path: p, config: config} 26 return plugin, nil 27 } 28 29 // Name . 30 func (p Plugin) Name() string { 31 return p.name 32 }