In fact there are two very common forms, usually this is done through a view engine of its language, which uses its own syntax, is one of the functionalities that it proves is precisely the access of variables that are passed from the your backend for your view and other operations can also be performed, in the case of Go, I see people using this here: link .
The other way would be through ajax requests to your back end that would return you data and with that you would perform relevant tasks to mount your front end according to the data returned.