cmd/godoc: synchronously init corpus for index mode

The corpus needs to be init'd before generating the index.

Regression caused by CL 141397.

Updates golang/go#25443.

Change-Id: I04d19bf5d279031cc8ddf0f850d81eb06fc5efa8
Reviewed-on: https://go-review.googlesource.com/c/141717
Run-TryBot: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/godoc/main.go b/cmd/godoc/main.go
index 5d63387..65843dd 100644
--- a/cmd/godoc/main.go
+++ b/cmd/godoc/main.go
@@ -241,8 +241,10 @@
 	if *writeIndex {
 		corpus.IndexThrottle = 1.0
 		corpus.IndexEnabled = true
+		initCorpus(corpus)
+	} else {
+		go initCorpus(corpus)
 	}
-	go initCorpus(corpus)
 
 	// Initialize the version info before readTemplates, which saves
 	// the map value in a method value.