Skip to content

text/template: Comment nodes not show in tree #48150

@sergiuilie

Description

@sergiuilie

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

$ go version
go version go1.17 windows/amd64

Does this issue reproduce with the latest release?

Yes, this issue is present in go1.17

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

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\SIlie\AppData\Local\go-build
set GOENV=C:\Users\SIlie\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\SIlie\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\SIlie\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\SIlie\AppData\Local\Temp\go-build1192418538=/tmp/go-build -gno-record-gcc-switches

What did you do?

Having a simple comment or a comment with white space trimmed from the preceding and the following text, I am running the template.ParseFiles for my HTML file which contains a comment and I am not able to see the comment node in the tree list, while debugging I observe that the parser doesn't analyze this node at all. It does not matter if the file contains other nodes or not at all, the result is the same.

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

What did you expect to see?

The comment node is present in the tree.

What did you see instead?

Nothing, comment node is not present in the tree.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions