Commit 120d0b50 authored by Rob Pike's avatar Rob Pike

forgot to count newlines when scanning white space.

also fix a error-printing bug in godoc.

R=gri
http://go/go-review/1016030
parent c83b8386
......@@ -446,8 +446,8 @@ func readTemplate(name string) *template.Template {
if err != nil {
log.Exitf("ReadFile %s: %v", path, err);
}
t, err1 := template.Parse(string(data), fmap);
if err1 != nil {
t, err := template.Parse(string(data), fmap);
if err != nil {
log.Exitf("%s: %v", name, err);
}
return t;
......
......@@ -275,6 +275,7 @@ Loop:
// consume trailing white space
for ; i < len(t.buf) && white(t.buf[i]); i++ {
if t.buf[i] == '\n' {
t.linenum++;
i++;
break // stop after newline
}
......@@ -850,7 +851,7 @@ func (t *Template) Parse(s string) os.Error {
}
t.buf = strings.Bytes(s);
t.p = 0;
t.linenum = 0;
t.linenum = 1;
t.parse();
return t.error;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment