red888
red888

Reputation: 31560

How do I concatenate strings inside a variable assignment?

I'm trying to assign the output of a function to a var and append to the string at the same time but can't figure out the right syntax.

None of these examples work:

{{- $myvar := include "mychart.helper" . "-myprefix" -}}
{{- $myvar := {{include "mychart.helper" .}} "-myprefix" -}}
{{- $myvar := (include "mychart.helper" .) "-myprefix" -}}

Upvotes: 4

Views: 3672

Answers (1)

red888
red888

Reputation: 31560

It seems the right way to do this is to use the print() function

{{- $myvar := print (include "mychart.helper" .) "-myprefix" -}}

Upvotes: 5

Related Questions