1
0
mirror of https://github.com/golang/go synced 2024-11-05 16:46:10 -07:00

godoc: add Corpus.ReadIndexFrom, which will be useful for creating a split

indexing/frontend godoc instance.

R=sameer, sameer
CC=golang-codereviews
https://golang.org/cl/78850043
This commit is contained in:
Brad Garcia 2014-06-20 06:24:12 -04:00
parent 5c5c4f4888
commit 87e741c38f

View File

@ -1430,8 +1430,13 @@ func (c *Corpus) readIndex(filenames string) error {
defer f.Close()
files = append(files, f)
}
return c.ReadIndexFrom(io.MultiReader(files...))
}
// ReadIndexFrom sets the current index from the serialized version found in r.
func (c *Corpus) ReadIndexFrom(r io.Reader) error {
x := new(Index)
if _, err := x.ReadFrom(io.MultiReader(files...)); err != nil {
if _, err := x.ReadFrom(r); err != nil {
return err
}
if !x.CompatibleWith(c) {