Do you know if it's possible to create interactive web pages in Go? For example, having one or multiple buttons, or a combo box that refreshes the page with the data being filtered according to the choice? I've tried to look for it but didn't find anything relevant.
Thanks in advance.
Browsers are not capable of running Go code directly. Interactive web pages at the client side use different technologies, such as HTML, Javascript and CSS.
However, it is a viable technology stack to use the above mentioned languages at the client side, and do everything in Go at the server side.
That being said, there are still some frameworks that allow you to write everything in Go, and they transform your Go code to languages understood / supported by the client side, or they generate code for the client side that interact with the server-side Go code.
For the latter, there is Gowut (Go Web UI Toolkit) (disclosure: I'm the author). With Gowut, you can write everything in Go (both the client and the server side), and Gowut generates the necessary client code on-the-fly, and it takes care of the communication between the generated client code and the Go server code. There is a live demo of Gowut, you can check it out and see what it is capabe of here: Gowut - Showcase of Features
Gowut creates completely dynamic webpages, the content is rendered and can change without page reload. And still, everything can be done simply using Go code, but you have the possibility to use HTML / JS / CSS code to spice things up – should you have the urge or need to do so.
For the former, there's GopherJS and Go's WebAssembly target added in Go 1.11. GopherJS compiles Go code to pure Javascript code, so it's not really a web framework, but you can write client side code in Go with that. You still have to take care of server-side code and the communication between them. The WebAssembly target works similarly to GopherJS: you write Go code which will be compiled to a form that is capable running in the browser (run by the browser). The linked wiki page holds all the details how this can be achieved / used.
There is also a powerful template engine in the standard library:
html/template
. Although templates are executed exclusively at the server side, with the help of some basic Javascript code and AJAX calls (or websockets), you can make your client side dynamic and interactive. For examples, see these questions and answers:Creating load more button in Golang with templates
Dynamically refresh a part of the template when a variable is updated golang
Referencing Go array in Javascript