1
0
mirror of https://github.com/golang/go synced 2024-11-19 14:44:40 -07:00

forgot to count newlines when scanning white space.

also fix a error-printing bug in godoc.

R=gri
http://go/go-review/1016030
This commit is contained in:
Rob Pike 2009-11-02 20:35:52 -08:00
parent c83b838641
commit 120d0b50c6
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}