Hacker News new | ask | show | jobs
by Philip-J-Fry 1366 days ago
I've written plugins in Go. You don't really need to use the plugin package, and you probably shouldn't anyway.

One way I've done it in the past is via sub processes talking via stdin/stdout. Another way I've done it is just via a regular REST API.

You'll never get enough performance for a lot of tasks if you need to pass a lot of data between applications. But depending on your needs it's more than serviceable. The benefit of this is that plugins don't need to be written in Go, as you have a simple interface.

A good example of this is something like LSP. LSP plugins are abundant and each one is written in a different language. VSCode is Typescript, the Go language server is written in Go. Both can speak to eachother fast enough.

1 comments

Unfortunately, the performance as you point out is not even close. Not only that, but the API is way more limited by the transport protocol, instead of being able to directly use language interfaces. If you write plugins for PHP, they are just as fast as the basic software. If you write plugins for C# (dlls), they are as fast as the language. Writing using grpc has substantial development overhead and performance overhead, so it makes Go a bad choice by default