简体   繁体   中英

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" -}}

似乎正确的方法是使用 print() 函数

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM