You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Error is:
template: test:11: function "nonExistingFunction" not defined
While it should be:
template: test:6: function "nonExistingFunction" not defined
mvdan
changed the title
text/template Parse does not report error line correctly
text/template: Parse does not report error line correctly
Aug 28, 2018
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.
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.
The text was updated successfully, but these errors were encountered: