]> Cypherpunks repositories - gostls13.git/commitdiff
forgot to count newlines when scanning white space.
authorRob Pike <r@golang.org>
Tue, 3 Nov 2009 04:35:52 +0000 (20:35 -0800)
committerRob Pike <r@golang.org>
Tue, 3 Nov 2009 04:35:52 +0000 (20:35 -0800)
also fix a error-printing bug in godoc.

R=gri
http://go/go-review/1016030

src/cmd/godoc/godoc.go
src/pkg/template/template.go

index 8b28082a198d21a54dbdb652510c884f08835283..cd438a9b2c0bf5e263a63fcc45e3fe0029b6e886 100644 (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;
index 9af8577debceb94ab02b4045c629546ec227a2b1..cd0514ba22145e4d17eccdfbe403854becb5b4a8 100644 (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;
 }