OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // +build ignore | 5 // +build ignore |
6 | 6 |
7 package main | 7 package main |
8 | 8 |
9 // This file replaces main.go when running godoc under app-engine. | 9 // This file replaces main.go when running godoc under app-engine. |
10 // See README.godoc-app for details. | 10 // See README.godoc-app for details. |
(...skipping 24 matching lines...) Expand all Loading... |
35 *maxResults = 100 // reduce latency by limiting the number of fulltex
t search results | 35 *maxResults = 100 // reduce latency by limiting the number of fulltex
t search results |
36 *indexThrottle = 0.3 // in case *indexFiles is empty (and thus the index
er is run) | 36 *indexThrottle = 0.3 // in case *indexFiles is empty (and thus the index
er is run) |
37 | 37 |
38 // read .zip file and set up file systems | 38 // read .zip file and set up file systems |
39 const zipfile = zipFilename | 39 const zipfile = zipFilename |
40 rc, err := zip.OpenReader(zipfile) | 40 rc, err := zip.OpenReader(zipfile) |
41 if err != nil { | 41 if err != nil { |
42 log.Fatalf("%s: %s\n", zipfile, err) | 42 log.Fatalf("%s: %s\n", zipfile, err) |
43 } | 43 } |
44 // rc is never closed (app running forever) | 44 // rc is never closed (app running forever) |
45 » fs = NewZipFS(rc) | 45 » fs.Bind("/", NewZipFS(rc, zipFilename), "/", bindReplace) |
46 » fsHttp = NewHttpZipFS(rc, *goroot) | |
47 | 46 |
48 // initialize http handlers | 47 // initialize http handlers |
49 readTemplates() | 48 readTemplates() |
50 initHandlers() | 49 initHandlers() |
51 registerPublicHandlers(http.DefaultServeMux) | 50 registerPublicHandlers(http.DefaultServeMux) |
52 | 51 |
53 // initialize default directory tree with corresponding timestamp. | 52 // initialize default directory tree with corresponding timestamp. |
54 initFSTree() | 53 initFSTree() |
55 | 54 |
56 // initialize directory trees for user-defined file systems (-path flag)
. | |
57 initDirTrees() | |
58 | |
59 // Immediately update metadata. | 55 // Immediately update metadata. |
60 updateMetadata() | 56 updateMetadata() |
61 | 57 |
62 // initialize search index | 58 // initialize search index |
63 if *indexEnabled { | 59 if *indexEnabled { |
64 go indexer() | 60 go indexer() |
65 } | 61 } |
66 | 62 |
67 log.Println("godoc initialization complete") | 63 log.Println("godoc initialization complete") |
68 } | 64 } |
OLD | NEW |