去捕获模板变量和名称

I am experimenting with Go's templates.

I am curious: is it possible to do the following: {{$myVariable := randomStringFunc | saveFunc}}

Where:
$myVariable - randomly chosen variable name
randomStringFunc - function that generates random strings
TRICKY: saveFunc - a function that saves the variable name and its value

I have looked into capture-or-assign-golang-template-output-to-variable but I am not sure how and if it can help me achieve my goal.

EDIT In the end I would like to have a mapping between the variable name that is defined in the template and the value that is assigned to it:

var variableMapping map[string]string
After template execution the content of variableMapping should be something like:

{
"$myVariable:"randomString1",
"$anotherVariable":"5",
"$thirdVariableInMyTemplate":"false"
}