-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Description
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
1.11
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/jgiroux/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jgiroux/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/b8/dm3gflg51t124m16nvqdxzm9d1phdx/T/go-build077675676=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
If a template contains multiline strings (enclosed in backtick) and there is an error when calling Parse, the error line reported is not correct. However, if an error occurs during Execute, the error reports both line and column and they are correct.
1 {{ $var := `Multi
2
3
4
5 Line` -}}
6 Hello {{ nonExistingFunction $var }}
Error is:
template: test:11: function "nonExistingFunction" not defined
While it should be:
template: test:6: function "nonExistingFunction" not defined
See complete examples on Go Playground
What did you expect to see?
The right error line number 😃, i.e. the same behaviour as in Execute.
What did you see instead?
Error line reported are increased by the number of line composing multiline string previously defined.