Suggestion for `scenarigo plugin build` setting
konifar opened this issue ยท 1 comments
ref: #140
Overview
I tried scenarigo plugin build
and it worked well! ๐
I have one request for the plugin configuration in scenarigo.yaml.
To come to the point, it might be better to work by only pluginDirectory
setting.
Details
If I run scenarigo plugin build
under this configuration below, it works as well as go build -buildmode=plugin -o ./plugins/gen.so ./plugins/gen.go
|--plugins
| |--gen.go
| |--gen.so
|--scenarigo.yaml
pluginDirectory: ./plugins
plugins:
gen.so:
src: ./plugins/gen.go
But I guess the plugin .so
file and the source .go
file are in the same directory in many cases.
So it would be better to work by only pluginDirectory
setting.
pluginDirectory: ./plugins
If we don't specify plugins
setting, all the .go
files in ./plugins
dir would be built to .so
file with the same name.
It's just my suggestion. What do you think? ๐ @zoncoen
Thank you for your feedback!
It is a good idea to better default behavior for usability.
However, there is a point that bothers me.
Go does not allow multiple modules to be defined in a single directory.
Therefore, it is also not common to put source code that will be built into multiple binaries (plugins) in the same directory.
For example, the following directory structure is not general.
|--plugins
| |--foo.go
| |--bar.go
|--gen
| |--foo.so
| |--bar.so
|--scenarigo.yaml
This is more common sense, I think.
|--plugins
| |--foo
| |--main.go
| |--bar
| |--main.go
|--gen
| |--foo.so
| |--bar.so
|--scenarigo.yaml
Of course, we can build all main packages of the plugin directory if no plugins configuration.
However, I think it is not suitable for the default behavior because it seems too implicit.
BTW, I think the bad point of Scenarigo is that it is difficult to understand what purpose the field pluginDirectory
is used for.
It is my mistake. When I added the field, it was only used to simplify real plugin paths in test scenarios. ๐ค