Open blackb1rd opened 8 months ago
At the same time you posted this, I happened to be asking about this kind of functionality in the forum: https://discourse.gohugo.io/t/is-there-a-way-to-make-a-reusable-partial-component-that-could-be-shared-easily/48940
https://pkg.go.dev/plugin@master#hdr-Warnings
Warnings
However, the plugin mechanism has many significant drawbacks that should be considered carefully during the design. For example:
- Plugins are currently supported only on Linux, FreeBSD, and macOS, making them unsuitable for applications intended to be portable.
- ...
- Together, these restrictions mean that, in practice, the application and its plugins must all be built together by a single person or component of a system. In that case, it may be simpler for that person or component to generate Go source files that blank-import the desired set of plugins and then compile a static executable in the usual way.
That doesn't sound so great.
this idea may be similar to #10633 #11085
but this is using .so file or calling function from dynamic library
Example project: https://github.com/vladimirvivien/go-plugin-example
so, anyone can implement hugo plugin with loading dynamic library and able to call function in template.