-
-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support -buildmode=plugin linkopt #539
Comments
I'd like to do this eventually, but it won't be simple. When you build a plugin, I tried building a small binary with |
I have a plan to allow support for this kind of thing using output groups but it's stacked up behind platforms and cross compilation and I'm not 100% sure it will work without actually trying it. |
@ianthehat Any progress on that? I'm very interested in this feature. :) |
No direct progress, but we are now in a good state to add more build modes. We build everything in multiple modes, including the standard library, so it's easy to add more, I have not done most of the |
Awesome! For Right now I'm loading the plugin in runtime using an environment variable that contains the path of the loadable module. So it is pretty flexible. I have no opinion on how to make it available to the binary/test, as long it is available to be easily loaded at runtime. Just so you can have a taste of how the plugin is loaded in Go: filepath := "my_plugin.so" // Could be a relative path to the current working directory or an absolute path.
plug, err := plugin.Open(filepath)
if err != nil {
...
}
// Use plug... I don't see a reason to make it available to another library since it is a runtime thing. |
So it's just like a binary, except you set buildmode=plugin when building it? |
I'm not sure how it is done internally. I never dig into it. I would assume it is just
Binaries that load a plugin does not need anything special. With the go tooling, I just run the classic There is this Medium post that I find very good. There is a very simple example in the post that you can base your tests! |
This removes the hard coded list of standard libraries, and builds it per aspect being propagated. This is both cleaner and a pre-requisite for the additional link modes to work. Related to bazel-contrib#1264 and bazel-contrib#54 and bazel-contrib#539
This should work now with |
I tried
And got:
The text was updated successfully, but these errors were encountered: