Use same argument twice in a printf clause

I cannot remember or (find anywhere) how to use multiple times an argument in a printf clause:
Something like:

{{ printf "%1s is the same as %1s and %2s is different" $arg1 $arg2 }}

Anybody know? :man_shrugging:

You have to repeat the β€œsame”, e.g.

{{ printf "%1s is the same as %1s and %2s is different" $arg1 $arg1  $arg2 }}

Thanks! What have been doing but I wondered if there was another way. Oh well.

No, but the printf delegates directly to fmt.Printf in Go – which has plenty of powers in other areas worth investigating.

1 Like