Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo: invalid comment delimiter in README #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Jumpaku
Copy link

@Jumpaku Jumpaku commented Feb 20, 2024

In this pull request, I revised {{ /* Go Template */ }} to {{- /* Go Template */ -}} in the README description, aligning it with the content in the screenshot "comment.png".

The original {{ /* Go Template */ }} is considered an invalid comment because there are spaces between {{ and /* or */ and }} according to https://pkg.go.dev/text/template#hdr-Actions

{{/* a comment */}}
{{- /* a comment with white space trimmed from preceding and following text */ -}}
	A comment; discarded. May contain newlines.
	Comments do not nest and must start and end at the
	delimiters, as shown here.

It should be written as {{- /* Go Template */ -}} or {{/* Go Template */}}.
In fact, the following code panics with an error panic: template: comments:1: unexpected "/" in command

package main

import "text/template"

func main() {
	template.Must(template.New("comments").Parse("{{ /* Go Template */ }}"))
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant