That is a feature of the Go template engine, although it's not a new idea, if you used unix systems, you can do the same in shell commands (think of e.g. ls |more
).
It's called "chaining": you specify a sequence of commands, and the output of each is used as the input of the next in the chain.
It's documented at text/template
:
A pipeline may be "chained" by separating a sequence of commands with pipeline characters '|'. In a chained pipeline, the result of each command is passed as the last argument of the following command. The output of the final command in the pipeline is the value of the pipeline.
The Go template engine only allows you to register and call functions and methods with a single return value; or 2 return values of which the second must be of type error
(which is checked to tell if the call is considered successful, and non-nil
errors terminate the template execution with an error). So you can't chain commands that have multiple return values, and you can't specify tuples to pass multiple values to functions having multiple parameters.
For more about pipelines, see golang template engine pipelines