I tried to couple of articles and also official page but I still don't get it. Can anyone do an ELI5?
I am coming from Python, so something comparable to Python, if exists, would be nice.
评论:
niosop:
It lets you load and execute code at runtime. I guess an example might be best. Say you have a metrics collection program written in Go. It knows how to use SNMP to collect metrics from SNMP capable devices. If you wanted to be able to add the ability to use SSH to connect to a device and get some data, then you'd need to add that to the code and recompile it. Anyone else who wanted to use your SSH code would either have to use your forked version, or download and apply your patches to the base distribution.
A better way would be to use a plugin system. The base collector program would define the function signature required for any collector, and people could write plugins that do whatever they want. Then they could just drop the plugin into a directory, modify a config file to tell it to use the plugin, and the base program could read a list of plugins from the config file, load those plugins, then execute the collection function for each plugin. People would no longer have to recompile or use a forked version, they could just download your plugin.
