diff options
| author | Shenghou Ma <minux.ma@gmail.com> | 2013-01-22 02:48:40 +0800 |
|---|---|---|
| committer | Shenghou Ma <minux.ma@gmail.com> | 2013-01-22 02:48:40 +0800 |
| commit | bee148bf23701f1b82d4d1d1187e3ef60ba724d7 (patch) | |
| tree | ede689de6ac4746e4f25c71a9da85640a6508955 /src/pkg/text/template/parse/parse.go | |
| parent | 5b5d3efcf3003de01e0cd8ecb248c9ef72d30b10 (diff) | |
| download | go-bee148bf23701f1b82d4d1d1187e3ef60ba724d7.tar.xz | |
text/template/parse: don't show itemType in error messages
so that the user don't need to decipher something like this:
template: main:1: expected %!s(parse.itemType=14) in end; got "|"
now they get this:
template: main:1: unexpected "|" in end
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7128054
Diffstat (limited to 'src/pkg/text/template/parse/parse.go')
| -rw-r--r-- | src/pkg/text/template/parse/parse.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pkg/text/template/parse/parse.go b/src/pkg/text/template/parse/parse.go index 250cad5f35..c0fb9274a3 100644 --- a/src/pkg/text/template/parse/parse.go +++ b/src/pkg/text/template/parse/parse.go @@ -151,7 +151,7 @@ func (t *Tree) error(err error) { func (t *Tree) expect(expected itemType, context string) item { token := t.nextNonSpace() if token.typ != expected { - t.errorf("expected %s in %s; got %s", expected, context, token) + t.unexpected(token, context) } return token } @@ -160,7 +160,7 @@ func (t *Tree) expect(expected itemType, context string) item { func (t *Tree) expectOneOf(expected1, expected2 itemType, context string) item { token := t.nextNonSpace() if token.typ != expected1 && token.typ != expected2 { - t.errorf("expected %s or %s in %s; got %s", expected1, expected2, context, token) + t.unexpected(token, context) } return token } |
