I am also looking for ways to use Go with Javascript. But I have found no other way to communicate between an interpreted and compiled language (they do not share the same engine) than some sort of micro services. I e send messages back and forth. I should be glad proven wrong.
Could you please give some more detail of your expected architecture - i.e are you using JS from browser or NodeJS. Do you want to run Go on the same machine? Are you using mobile/desktop/devices? What O/S (shouldn’t matter though)?
e.g. I use browser JS with a Go http server (windows) using REST - and also using web sockets for push from server. For this I use standard Go server.http with mux and websocket. I also use getlantern/systray to have an icon you can use to open chrome, using lorca, after the server is running, i.e for an editor in my case. Note that I only need max 60 frame/s updates which may not be your case…
I’m guessing your concern is performance will suffer - but maybe you would be best off benchmarking a go http server and seeing what the performance is like, since the overhead may be insigificant - it really depends on how often you call the Go functions and how much work gets done by them.
You may also find you can send multiple requests at once which could benefit. Or turning a set of function calls into a single ‘service’.
I also recommend checking out tinygo - which is only a bit less than full go - but seems better for Wasm - which you could then use from nodejs directly - but, if you use wasm, you won’t get any performance benefit from using compiled Go.
Without knowing the library you are using and how frequently/what for, this is still uncertain - benchmarking should help.