Formatting issues with comment syntax and spaces in chezmoi templates #4217
-
I have been experimenting with the comment syntax in chezmoi templates and encountered some unexpected behavior. chezmoi execute-template '{{/* test */}}' # success
chezmoi execute-template '{{- /* test */ -}}' # success
chezmoi execute-template '{{- /* test */ -}}' # error
# chezmoi: template: arg1:1: unexpected "/" in command
chezmoi execute-template '{{- /* test */ -}}' # error
# chezmoi: template: arg1:1: comment ends before closing delimiter
chezmoi execute-template '{{ /* test */ -}}' # error
# chezmoi: template: arg1:1: unexpected "/" in command My questions are:
|
Beta Was this translation helpful? Give feedback.
Answered by
halostatue
Jan 21, 2025
Replies: 1 comment
-
This is more of a go text/template question than a chezmoi question, but comments may only be either
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
halostatue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is more of a go text/template question than a chezmoi question, but comments may only be either
{{/*
|*/}}
or{{- /*
|*/ -}}
. You can have the whitespace removal on either end without requiring a match on both sides. So the following four combinations are permitted: