Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text/template: whitespace removal messes up error line numbers #21778

Closed
natefinch opened this issue Sep 6, 2017 · 3 comments
Closed

text/template: whitespace removal messes up error line numbers #21778

natefinch opened this issue Sep 6, 2017 · 3 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@natefinch
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

What did you do?

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

Note that the error is on line 4, but is reported on line 3. If you remove the - from the template, the correct error message is reported.

System details

go version go1.9 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/finchnat"
GORACE=""
GOROOT="/Users/finchnat/src/github.com/golang/go"
GOTOOLDIR="/Users/finchnat/src/github.com/golang/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/ch/4d1vgsv17jq0b3yfmnkl9thdk0jm7d/T/go-build584589423=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
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"
GOROOT/bin/go version: go version go1.9 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.9
uname -v: Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G29
lldb --version: lldb-370.0.42
  Swift-3.1
@mvdan mvdan added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 6, 2017
@mvdan
Copy link
Member

mvdan commented Sep 6, 2017

I'll take a stab at this; thanks for the reproducer.

@mvdan mvdan self-assigned this Sep 6, 2017
@mvdan mvdan added this to the Go1.10 milestone Sep 6, 2017
@mvdan
Copy link
Member

mvdan commented Sep 6, 2017

CL sent; this is a regression introduced with whitespace trimming last year.

@gopherbot
Copy link

Change https://golang.org/cl/61870 mentions this issue: text/template: fix pos info when trimming newlines

@golang golang locked and limited conversation to collaborators Sep 7, 2018
@rsc rsc unassigned mvdan Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants