(path string, args []string)
| 177 | } |
| 178 | |
| 179 | func loadPlugin(path string, args []string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error) { |
| 180 | mod, err := plugin.Open(path) |
| 181 | if err != nil { |
| 182 | return nil, nil, nil, fmt.Errorf("open multitype plugin %s: %s", path, err) |
| 183 | } |
| 184 | |
| 185 | conf, err := readPluginConfig(path) |
| 186 | if err != nil { |
| 187 | return nil, nil, nil, fmt.Errorf("failed to read config for %s: %s", path, err) |
| 188 | } |
| 189 | |
| 190 | sym, err := mod.Lookup("InitPlugin") |
| 191 | if err != nil { |
| 192 | return nil, nil, nil, fmt.Errorf("lookup module symbol failed for %s: %s", path, err) |
| 193 | } |
| 194 | return initPlugin(sym, path, append(conf, args...)) |
| 195 | } |
| 196 | |
| 197 | func initPlugin(sym plugin.Symbol, path string, args []string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error) { |
| 198 | fn, ok := sym.(func([]string) ([]filters.Spec, []routing.PredicateSpec, []routing.DataClient, error)) |
no test coverage detected
searching dependent graphs…