mirror of
https://github.com/golang/go
synced 2024-11-05 17:16: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:
parent
5c5c4f4888
commit
87e741c38f
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user