celestiaorg / celestia-core

A fork of CometBFT
Apache License 2.0
489 stars 269 forks source link

ipld plugin: refactor to make it injectable #150

Closed liamsi closed 3 years ago

liamsi commented 3 years ago

As far as I understand, go plugins need to be defined in a main package to work properly (-buildmode=plugin requires exactly one main package).

That's the approach we took in #144: https://github.com/lazyledger/lazyledger-core/blob/dbd2daf493669489abd16e94c315596d6504c667/p2p/ipld/plugin/plugin.go#L1

It seems possible to load the plugin using loader.Preload though: https://github.com/ipfs/go-ipfs/blob/7588a6a52a789fa951e1c4916cee5c7a304912c2/plugin/loader/loader.go#L28

That would only work if the Plugin was in an importable lib/package (not main). Ideally, both would be possible.

liamsi commented 3 years ago

This was tackled in #155