* Pawan Kumar <
pawa...@gmail.com> [210528 12:43]:
Neither the slice expression in the Go language, nor the slice function
in the text/template and html/template packages allow negative slice
indexes. Also, the template language does not allow arbitrary
arithmetic expressions directly. However, you can define your own
functions for the template and use them. In this playground example,
«
https://play.golang.org/p/yvFRYVe2Bu5», I defined a function "sub" that
I use to calculate the correct arguments to the slice function.
You can also use variables to avoid repeating long expressions:
{{$c := index .ServiceMeta "cluster_name"}}
{{slice $c (sub (len $c) 2) (len $c)}}
...Marvin