diff --git a/cmd/tipgodoc/Dockerfile b/cmd/tipgodoc/Dockerfile index ac958192..760ca0bb 100644 --- a/cmd/tipgodoc/Dockerfile +++ b/cmd/tipgodoc/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.4.1 +FROM golang:1.4.2 RUN apt-get update && apt-get install --no-install-recommends -y -q build-essential git diff --git a/cmd/tipgodoc/tip.go b/cmd/tipgodoc/tip.go index 4a92a5c1..dbd7f1f3 100644 --- a/cmd/tipgodoc/tip.go +++ b/cmd/tipgodoc/tip.go @@ -8,6 +8,7 @@ package main import ( "bufio" + "bytes" "encoding/json" "fmt" "io" @@ -28,6 +29,8 @@ const ( metaURL = "https://go.googlesource.com/?b=master&format=JSON" ) +var indexingMsg = []byte("Indexing in progress: result may be inaccurate") + func main() { p := new(Proxy) go p.run() @@ -165,7 +168,7 @@ func initSide(side, goHash, toolsHash string) (godoc *exec.Cmd, hostport string, if side == "b" { hostport = "localhost:8082" } - godoc = exec.Command(godocBin, "-http="+hostport) + godoc = exec.Command(godocBin, "-http="+hostport, "-index", "-index_interval=-1s") godoc.Env = []string{"GOROOT=" + goDir} // TODO(adg): log this somewhere useful godoc.Stdout = os.Stdout @@ -180,18 +183,21 @@ func initSide(side, goHash, toolsHash string) (godoc *exec.Cmd, hostport string, } }() - for i := 0; i < 15; i++ { + for i := 0; i < 120; i++ { time.Sleep(time.Second) var res *http.Response - res, err = http.Get(fmt.Sprintf("http://%v/", hostport)) + res, err = http.Get(fmt.Sprintf("http://%v/search?q=FALLTHROUGH", hostport)) if err != nil { continue } + rbody, err := ioutil.ReadAll(res.Body) res.Body.Close() - if res.StatusCode == http.StatusOK { + if err == nil && res.StatusCode == http.StatusOK && + !bytes.Contains(rbody, indexingMsg) { return godoc, hostport, nil } } + godoc.Process.Kill() return nil, "", fmt.Errorf("timed out waiting for side %v at %v (%v)", side, hostport, err) }