Skip to content

text/template: template comment spacing #24767

@consideRatio

Description

@consideRatio

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions