LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 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 package main | 5 package main |
6 | 6 |
7 import ( | 7 import ( |
8 "bytes" | 8 "bytes" |
9 "encoding/json" | 9 "encoding/json" |
10 "flag" | 10 "flag" |
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 title = "Command " + tabtitle | 1096 title = "Command " + tabtitle |
1097 } | 1097 } |
1098 default: | 1098 default: |
1099 tabtitle = info.Dirname | 1099 tabtitle = info.Dirname |
1100 title = "Directory " + tabtitle | 1100 title = "Directory " + tabtitle |
1101 if *showTimestamps { | 1101 if *showTimestamps { |
1102 subtitle = "Last update: " + info.DirTime.String() | 1102 subtitle = "Last update: " + info.DirTime.String() |
1103 } | 1103 } |
1104 } | 1104 } |
1105 | 1105 |
| 1106 // special cases for top-level package/command directories |
| 1107 switch tabtitle { |
| 1108 case "/src/pkg": |
| 1109 tabtitle = "Packages" |
| 1110 case "/src/cmd": |
| 1111 tabtitle = "Commands" |
| 1112 } |
| 1113 |
1106 contents := applyTemplate(packageHTML, "packageHTML", info) | 1114 contents := applyTemplate(packageHTML, "packageHTML", info) |
1107 servePage(w, tabtitle, title, subtitle, "", contents) | 1115 servePage(w, tabtitle, title, subtitle, "", contents) |
1108 } | 1116 } |
1109 | 1117 |
1110 // ---------------------------------------------------------------------------- | 1118 // ---------------------------------------------------------------------------- |
1111 // Search | 1119 // Search |
1112 | 1120 |
1113 var searchIndex RWValue | 1121 var searchIndex RWValue |
1114 | 1122 |
1115 type SearchResult struct { | 1123 type SearchResult struct { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 updateIndex() | 1423 updateIndex() |
1416 } | 1424 } |
1417 delay := 60 * time.Second // by default, try every 60s | 1425 delay := 60 * time.Second // by default, try every 60s |
1418 if *testDir != "" { | 1426 if *testDir != "" { |
1419 // in test mode, try once a second for fast startup | 1427 // in test mode, try once a second for fast startup |
1420 delay = 1 * time.Second | 1428 delay = 1 * time.Second |
1421 } | 1429 } |
1422 time.Sleep(delay) | 1430 time.Sleep(delay) |
1423 } | 1431 } |
1424 } | 1432 } |
LEFT | RIGHT |