in fact there are two very common ways, usually this is done through a view engine of its language, of which it uses its own syntax, is one of the functionalities that it proves is precisely the realization of access variables that are passed from its back-end to your view and can also be performed other operations, in the case of Go, I see people using this one: https://github.com/sipin/gorazor.
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 assemble your front-end according to the returned data.