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

text/template: template comment spacing #24767

Closed
consideRatio opened this issue Apr 8, 2018 · 4 comments
Closed

text/template: template comment spacing #24767

consideRatio opened this issue Apr 8, 2018 · 4 comments

Comments

@consideRatio
Copy link

@consideRatio consideRatio commented Apr 8, 2018

What version of Go are you using (go version)?

1.10.1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/erik/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/erik/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build297993008=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/TwK2wtT5ty6

What did you expect to see?

I expected that the ability to write {{ /* and/or */ }} within template comments as {{- /* and */ -}} works fine (and actually require a spacing).

What did you see instead?

For using {{ /* i saw panic: template: startspace:1: unexpected "/" in command.
For using /* }} i saw panic: template: endspace:1: unexpected comment ends before closing delimiter in input


/cc @bacongobbler - thanks for the go playground example

@robpike
Copy link
Contributor

@robpike robpike commented Apr 9, 2018

It is working as intended, as the documentation says:

Comments do not nest and must start and end at the
delimiters

In the "{{- " case, the space is part of the delimiter, in effect.

The documentation could be improved, I admit.

@bcmills bcmills added this to the Unplanned milestone Apr 9, 2018
@gopherbot
Copy link

@gopherbot gopherbot commented Apr 18, 2018

Change https://golang.org/cl/107663 mentions this issue: text/template: improve comment example in doc

@consideRatio
Copy link
Author

@consideRatio consideRatio commented Apr 18, 2018

@robpike Thank you for your guidance on this! Sorry for being slow to follow it up! It seems to me my issue resided behind in front of the monitor (me), as I was not searching and looking within the documentation properly. I'm happy to close this as well, but I'll let you or Zheng Dayu do it as I see the referenced discussion here: https://go-review.googlesource.com/c/go/+/107663/1/src/text/template/doc.go

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 19, 2018

Change https://golang.org/cl/108017 mentions this issue: text/template: improve comment example in doc

@gopherbot gopherbot closed this in c6bbfbe Apr 19, 2018
@golang golang locked and limited conversation to collaborators Apr 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.