Home > Back-end >  what's the meaning of $_ in helm template
what's the meaning of $_ in helm template

Time:11-01

I want to know what's the meaning of $_ in helm template.

I konw helm template is using go sprig template:

helm function_list

But where can I find go template grammar document?

CodePudding user response:

$_ is a variable with the name _. The template grammar is described in the package documentation.

Because set function returns a value, the following template action emits undesired data to the output.

 {{set $myDict "name4" "value4"}}

The examples in Helm documentation use assignment to $_ to trap the output (assignments do not emit anything to the output).

 {{$_ := unset $myDict "name4"}}

A variable with any name can be used. The variable $_ is used by convention to indicate that the value is not used. This is somewhat similar to the use of the blank identifier in Go.

  • Related