Hello everyone
I do not know Go but need to adapt a Golang template file for my needs. The problem I am struggling is is how to create a variable which would be the effect of applyting values to a string template.
Specifically, I have $network.IP
defined (its value is 1.1.1.1
) and would like to create a new variable $host
which would be http://1.1.1.1:555
. This means that the template is http://<here comes the value>:555
.
I tried all kind of incantations of
{{ $host := {{ $network.IP | printf "http://%q:555" }} }}
but always get
2020/01/23 13:57:32 Unable to parse template: template: caddy.templ:8: unexpected "{" in command
How to approach this?