I have a very long printf
call in a Go template. Example:
{{ printf "mongodb://%s:%s@%s/%s?authSource=admin&replicaSet=%s&readPreference=nearest&w=majority" .Values.rocketchat.mongo.username .Values.rocketchat.mongo.password .Values.rocketchat.mongo.database .Values.mongodb-replicaset.replicaSetName | b64enc | quote }}
How can I split this across multiple lines (like below)?
{{ printf "mongodb://%s:%s@%s/%s?authSource=admin&replicaSet=%s&readPreference=nearest&w=majority"
.Values.rocketchat.mongo.username
.Values.rocketchat.mongo.password
.Values.rocketchat.mongo.database
.Values.mongodb-replicaset.replicaSetName
| b64enc | quote }}
struct
ormap
), then build that composite type line-by-line. But don't do that. Generally speaking, but doubly so in templates, if you feel your lines are too long, it means you need to refactor with a simplification. – Plectognath