Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.18 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/mprahl/.cache/go-build" GOENV="/home/mprahl/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/mprahl/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/mprahl/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/mprahl/git/go/src/go.mod" GOWORK="" 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-build4256537278=/tmp/go-build -gno-record-gcc-switches"
What did you do?
package main
import (
"os"
"text/template"
)
func main() {
tmpl, err := template.New("test").Delims("{{hub", "hub}}").Parse(`{{hub .Object.host hub}}`)
if err != nil {
panic(err)
}
err = tmpl.Execute(os.Stdout, struct{ Object map[string]string }{map[string]string{"host": "value"}})
if err != nil {
panic(err)
}
}
What did you expect to see?
go run test.go
value
What did you see instead?
go run test.go
panic: template: test:1: unexpected <.> in operand
goroutine 1 [running]:
main.main()
/tmp/test.go:11 +0x2ba
exit status 2