Thank you all very much for your help. That’s very useful links. The calculation should be no problem then.
Just one further inquiry: How is it possible to count up the $total variable in the loop and read it out as a global variable after the loop ended. (Sorry—I’m really completely new to Go as stated above).
Use Scratch. Using the $ (as I do below) allows you to take the global scope (or top-level node as it’s referred to in docs).
In your loop, do {{ $.Scratch.Set "globalTotal" $total }} to assign the Scratch variable “globalTotal” to be the value of your $total variable.
And then outside your loop do {{ $.Scratch.Get "globalTotal" }} to print it, or use the .Scratch.Get function in another function (for instance, to do math on or otherwise)