Electron UI for Golang Program?
Solution 1
The interaction of an application written in electron with its backend is exactly like a Web browser, therefore you have the same options (Web Api, Web Sockets, Ajax, etc.)
Solution 2
You can use go-astilectron it allows you to build cross-platform GUI apps with GO and HTML/JS/CSS (powered by Electron) (disclosure: I'm the author)
Solution 3
You can execute your command line app from your Electron app via child_process.spawn
and communicate with it via stdin
/stdout
.
Solution 4
Murlock Is an Electron wrapper for Golang to make it easy for this kind of app for Mac. They're working on Windows and looking for contributions for the other platforms.
Solution 5
Similarly to Murlock, may I dare to suggest Webview library. It's a thin wrapper over Webkit and MSHTML that runs on Windows 7+, MacOS, Linux and OpenBSD.
It is much smaller and easier than Electron. Also the resulting apps are smaller and less memory-hungry.
You may have a look at https://github.com/zserge/webview/tree/master/examples/todo-go for a Todo app example that compiles into a small standalone binary.
Related videos on Youtube
Comments
-
Ashkay about 3 years
I'd like to make a GUI in Electron for a Desktop Application written in Go (currently it's a command line tool).
What's the convention for communicating between the Electron and Go processes?
Would simply using the Go binary as an API work? Some sort of websocket communication?
-
Ashkay about 8 yearsI decided to use github.com/googollee/go-socket.io for the backend, and normal socket.io on the frontend. Thanks!
-
roeland about 7 yearsNice project, but I don't think it is a wrapper for Electron. The mac version uses WebKit. The windows version uses EdgeHTML.
-
Pioz almost 7 yearsMurlock is not a Electron wrapper. It's simply a Go package to build UI with html and css. But it looks like a very interesting project!
-
Per Svensson about 4 yearsBut worth mentioning... Ultralight has a very aggressive pricing model for anything above "indie" developers. "While muon itself is MIT licensed, Ultralight is not."
-
Danny almost 3 yearsFor anyone looking at this in 2021, Muon has stopped maintaining since 2019.