progrium/go-plugins — pull request #3 by rcoelho (2014-01-25 17:44:55+00:00)
Title: Fix bug: static plugin names are always empty [WIP] [Breaks BC]

Do not merge yet: WIP
Caution: breaks BC!

There's a bug in the function StaticPlugin where the call to Type.Name() (line 60) will always return an empty string.
This bug will make it impossible to register multiple static plugins, since the name is used as the key in the maps.

I fixed the bug by changing StaticPlugin's signature to make it receive a name for the plugin, just like LoadString works.
But this breaks BC. Other options are:
- Create a new function instead (something like NamedStaticPlugin), but this will leave StaticPlugin broken.
- Use Type.String() instead of Type.Name(), but this will make it impossible to register multiple plugin instances based on the same plugin.

Let me know how you want to proceed and I'll modify the examples and documentation and add them to this PR.

I'm just starting with Go; please let me know if I made an obvious mistake here :)