Giter Club home page Giter Club logo

Comments (13)

darren-west avatar darren-west commented on June 30, 2024 6

I would also agree an example of invoking a separate binary would be of great use here.

from go-plugin.

JalfResi avatar JalfResi commented on June 30, 2024 1

Just started to explore this package and should add that whilst the idea is simple in principle (plugin is executable, start process and RPC command between the host and plugin process) the implementation is way more complicated than that!

Maybe including a simple plugin manager as part of the project that covers most use cases for new users? Something that loads all the executable plugins from a specified directory, that adhere to a specific single interface? People could get up and running pretty quickly with something like that.

In fact, that is exactly what I need so once I've got something written I may be able to put together a pull request with that.

from go-plugin.

hleong25 avatar hleong25 commented on June 30, 2024 1

Here is my example of separating the simple single example into multiple binaries.

https://github.com/hleong25/hashicorp-goplugin-separate-binary-example

The main thing to get from this is that there is a library that is shared between the mainapp and plugins. The information needed is the interfaces and the plugin handshake configuration.

from go-plugin.

Skarlso avatar Skarlso commented on June 30, 2024 1

If someone finds this... I wrote this https://skarlso.github.io/2018/10/29/go-plugin-tutorial/ and also have it as a PR here: #84

from go-plugin.

spiderpoison avatar spiderpoison commented on June 30, 2024 1

I want a example for Reattach

from go-plugin.

nicmue avatar nicmue commented on June 30, 2024

Hey, maybe it helps to have a look in the plugin architecture of all the terraform plugins. I also needed a long time but this helped me a lot.

Plugin Mechanism:
https://github.com/hashicorp/terraform/tree/master/plugin

Builtin Plugins which are dynamically loaded:
https://github.com/hashicorp/terraform/tree/master/builtin

from go-plugin.

krzysztofantczak avatar krzysztofantczak commented on June 30, 2024

@darren-west the easiest way for me was to start here https://github.com/hashicorp/otto-example-app-plugin and here https://github.com/hashicorp/otto/tree/v0.2.0 (You are interested with most of the RPC and PLUGIN directories, also app/app.go and app/factory.go and command/plugin_manager.go - You can c&p them and use right away, just to start). Also terraform as reference for other features that are not available in otto was a great help. If You do it right, You can extract basic implementation and run your plugins with few clicks (yeah, without much digging at the beginning ;)).

Keep in mind, go-plugin seems really "raw" idea. Most of real features (like plugin manager) need to be implemented on top of it.

from go-plugin.

krzysztofantczak avatar krzysztofantczak commented on June 30, 2024

@JalfResi https://github.com/hashicorp/otto/blob/v0.2.0/command/plugin_manager.go - does the trick as plugin manager. Atm. i'm using this code with watcher on plugins directory - works pretty well. Also, good idea to create some real world examples.

from go-plugin.

drvan avatar drvan commented on June 30, 2024

Any updates on this? I'm trying (and failing) to produce even the most basic example of two binaries communicating using this library. Even splitting the example into two source files would help immensely, but I can't seem to get it to compile without including the implementation of Greeter(), which defeats the purpose of abstracting that implementation out into a plugin. Reading through terraform's code is tedious, at best, and in my opinion should never be a requirement to understanding a library.

I'd be happy to submit a PR for documentation/examples when I understand this better, but I need some direction to move forward.

from go-plugin.

JalfResi avatar JalfResi commented on June 30, 2024

Have to agree with the above poster; had exactly the same problem with the example being in one file and other hashicorp projects focusing on internal plugins. The dependence on "Greeter" is messy to work around.

In the meantime I've had to conclude this package is just not ready for public use

from go-plugin.

skx avatar skx commented on June 30, 2024

I've just worked on splitting up the single example into two binaries, which reflects how it will actually be used. While it doesn't close this issue entirely it does provide a simpler example & introduction.

from go-plugin.

mitchellh avatar mitchellh commented on June 30, 2024

The PR #20 was just merged which helps this, too :)

from go-plugin.

klayyu avatar klayyu commented on June 30, 2024

thanks for the greate work, any one has the java plugin impl?

from go-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.