Commit 72ddc876 authored by Robert Griesemer's avatar Robert Griesemer

godoc: remove uses of container/vector

In the process, rewrite index.go to use slices instead
of vectors, rewrite for-loops into range loops, and
generally simplify code (this code was written before
the launch of go and showed its age).

Also, fix a wrong import in appinit.go.

No significant performance changes (improvements);
most of time is spent elsewhere (measured on an stand-
alone MacBook Pro with SSD disk, running standard
godoc settings: godoc -v -http=:7777 -index).

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4875056
parent fd897ffc
......@@ -39,7 +39,7 @@
package main
import (
"alt/archive/zip"
"archive/zip"
"http"
"log"
"os"
......
......@@ -13,7 +13,6 @@
package main
import (
"container/vector"
"fmt"
"http"
"io"
......@@ -183,17 +182,17 @@ func codewalkDir(w http.ResponseWriter, r *http.Request, relpath, abspath string
serveError(w, r, relpath, err)
return
}
var v vector.Vector
var v []interface{}
for _, fi := range dir {
name := fi.Name()
if fi.IsDirectory() {
v.Push(&elem{name + "/", ""})
v = append(v, &elem{name + "/", ""})
} else if strings.HasSuffix(name, ".xml") {
cw, err := loadCodewalk(abspath + "/" + name)
if err != nil {
continue
}
v.Push(&elem{name[0 : len(name)-len(".xml")], cw.Title})
v = append(v, &elem{name[0 : len(name)-len(".xml")], cw.Title})
}
}
......
This diff is collapsed.
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